require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_SYS_CDEFS_ELF_H_)) {
    eval 'sub _SYS_CDEFS_ELF_H_ () {1;}' unless defined(&_SYS_CDEFS_ELF_H_);
    if(defined(&__LEADING_UNDERSCORE)) {
	eval 'sub _C_LABEL {
	    my($x) = @_;
    	    eval q( &__CONCAT( &_,$x));
	}' unless defined(&_C_LABEL);
	eval 'sub _C_LABEL_STRING {
	    my($x) = @_;
    	    eval q(\\"_\\"$x);
	}' unless defined(&_C_LABEL_STRING);
    } else {
	eval 'sub _C_LABEL {
	    my($x) = @_;
    	    eval q($x);
	}' unless defined(&_C_LABEL);
	eval 'sub _C_LABEL_STRING {
	    my($x) = @_;
    	    eval q($x);
	}' unless defined(&_C_LABEL_STRING);
    }
    if((defined(&__STDC__) ? &__STDC__ : undef)) {
	eval 'sub ___RENAME {
	    my($x) = @_;
    	    eval q( &__asm( &___STRING( &_C_LABEL($x))));
	}' unless defined(&___RENAME);
    } else {
	if(defined(&__LEADING_UNDERSCORE)) {
	    eval 'sub ___RENAME {
	        my($x) = @_;
    		eval q( &____RENAME( &_ $x));
	    }' unless defined(&___RENAME);
	    eval 'sub ____RENAME {
	        my($x) = @_;
    		eval q( &__asm( &___STRING($x)));
	    }' unless defined(&____RENAME);
	} else {
	    eval 'sub ___RENAME {
	        my($x) = @_;
    		eval q( &__asm( &___STRING($x)));
	    }' unless defined(&___RENAME);
	}
    }
    eval 'sub __indr_reference {
        my($sym,$alias) = @_;
	    eval q();
    }' unless defined(&__indr_reference);
    if((defined(&__STDC__) ? &__STDC__ : undef)) {
	eval 'sub __strong_alias {
	    my($alias,$sym) = @_;
    	    eval q( &__asm(\\".global \\"  &_C_LABEL_STRING($alias) \\"\\\\n\\"  &_C_LABEL_STRING($alias) \\" = \\"  &_C_LABEL_STRING($sym)););
	}' unless defined(&__strong_alias);
	eval 'sub __weak_alias {
	    my($alias,$sym) = @_;
    	    eval q( &__asm(\\".weak \\"  &_C_LABEL_STRING($alias) \\"\\\\n\\"  &_C_LABEL_STRING($alias) \\" = \\"  &_C_LABEL_STRING($sym)););
	}' unless defined(&__weak_alias);
	eval 'sub __weak_extern {
	    my($sym) = @_;
    	    eval q( &__asm(\\".weak \\"  &_C_LABEL_STRING($sym)););
	}' unless defined(&__weak_extern);
	if( &__GNUC_PREREQ__(4, 0)) {
	    eval 'sub __weak () { &__attribute__(( &__weak__));}' unless defined(&__weak);
	} else {
	    eval 'sub __weak () {1;}' unless defined(&__weak);
	}
	if( &__GNUC_PREREQ__(4, 0)) {
	    eval 'sub __weak_reference {
	        my($sym) = @_;
    		eval q( &__attribute__(( &__weakref__($sym))));
	    }' unless defined(&__weak_reference);
	} else {
	    eval 'sub __weak_reference {
	        my($sym) = @_;
    		eval q(;  &__asm(\\".weak \\"  &_C_LABEL_STRING($sym)));
	    }' unless defined(&__weak_reference);
	}
	if( &__GNUC_PREREQ__(4, 2)) {
	    eval 'sub __weakref_visible () { &static;}' unless defined(&__weakref_visible);
	} else {
	    eval 'sub __weakref_visible () { &extern;}' unless defined(&__weakref_visible);
	}
	eval 'sub __warn_references {
	    my($sym,$msg) = @_;
    	    eval q( &__asm(\\".pushsection .gnu.warning.\\" $sym \\"\\\\n\\" \\".ascii \\\\\\"\\" $msg \\"\\\\\\"\\\\n\\" \\".popsection\\"););
	}' unless defined(&__warn_references);
    } else {
	if(defined(&__LEADING_UNDERSCORE)) {
	    eval 'sub __weak_alias {
	        my($alias,$sym) = @_;
    		eval q( &___weak_alias( &_ $alias, &_ $sym));
	    }' unless defined(&__weak_alias);
	    eval 'sub ___weak_alias {
	        my($alias,$sym) = @_;
    		eval q( &__asm(\\".weak alias\\\\nalias = sym\\"););
	    }' unless defined(&___weak_alias);
	} else {
	    eval 'sub __weak_alias {
	        my($alias,$sym) = @_;
    		eval q( &__asm(\\".weak alias\\\\nalias = sym\\"););
	    }' unless defined(&__weak_alias);
	}
	if(defined(&__LEADING_UNDERSCORE)) {
	    eval 'sub __weak_extern {
	        my($sym) = @_;
    		eval q( &___weak_extern( &_ $sym));
	    }' unless defined(&__weak_extern);
	    eval 'sub ___weak_extern {
	        my($sym) = @_;
    		eval q( &__asm(\\".weak sym\\"););
	    }' unless defined(&___weak_extern);
	} else {
	    eval 'sub __weak_extern {
	        my($sym) = @_;
    		eval q( &__asm(\\".weak sym\\"););
	    }' unless defined(&__weak_extern);
	}
	eval 'sub __warn_references {
	    my($sym,$msg) = @_;
    	    eval q( &__asm(\\".pushsection .gnu.warning.sym\\\\n\\" \\".ascii \\\\\\"\\" $msg \\"\\\\\\"\\\\n\\" \\".popsection\\"););
	}' unless defined(&__warn_references);
    }
    if((defined(&__arm__) ? &__arm__ : undef)) {
	eval 'sub __ifunc {
	    my($name, $resolver) = @_;
    	    eval q( &__asm(\\".globl	\\"  &_C_LABEL_STRING($name) \\"\\\\n\\" \\".type	\\"  &_C_LABEL_STRING($name) \\", %gnu_indirect_function\\\\n\\"  &_C_LABEL_STRING($name) \\" = \\"  &_C_LABEL_STRING($resolver)));
	}' unless defined(&__ifunc);
	eval 'sub __hidden_ifunc {
	    my($name, $resolver) = @_;
    	    eval q( &__asm(\\".globl	\\"  &_C_LABEL_STRING($name) \\"\\\\n\\" \\".hidden	\\"  &_C_LABEL_STRING($name) \\"\\\\n\\" \\".type	\\"  &_C_LABEL_STRING($name) \\", %gnu_indirect_function\\\\n\\"  &_C_LABEL_STRING($name) \\" = \\"  &_C_LABEL_STRING($resolver)));
	}' unless defined(&__hidden_ifunc);
    } else {
	eval 'sub __ifunc {
	    my($name, $resolver) = @_;
    	    eval q( &__asm(\\".globl	\\"  &_C_LABEL_STRING($name) \\"\\\\n\\" \\".type	\\"  &_C_LABEL_STRING($name) \\", @gnu_indirect_function\\\\n\\"  &_C_LABEL_STRING($name) \\" = \\"  &_C_LABEL_STRING($resolver)));
	}' unless defined(&__ifunc);
	eval 'sub __hidden_ifunc {
	    my($name, $resolver) = @_;
    	    eval q( &__asm(\\".globl	\\"  &_C_LABEL_STRING($name) \\"\\\\n\\" \\".hidden	\\"  &_C_LABEL_STRING($name) \\"\\\\n\\" \\".type	\\"  &_C_LABEL_STRING($name) \\", @gnu_indirect_function\\\\n\\"  &_C_LABEL_STRING($name) \\" = \\"  &_C_LABEL_STRING($resolver)));
	}' unless defined(&__hidden_ifunc);
    }
    if(defined(&__arm__)) {
	if((defined(&__STDC__) ? &__STDC__ : undef)) {
	    eval 'sub __SECTIONSTRING {
	        my($_sec, $_str) = @_;
    		eval q( &__asm(\\".pushsection \\" $_sec \\",\\\\\\"MS\\\\\\",%progbits,1\\\\n\\" \\".asciz \\\\\\"\\" $_str \\"\\\\\\"\\\\n\\" \\".popsection\\"));
	    }' unless defined(&__SECTIONSTRING);
	} else {
	    eval 'sub __SECTIONSTRING {
	        my($_sec, $_str) = @_;
    		eval q( &__asm(\\".pushsection \\" $_sec \\",\\\\\\"MS\\\\\\",%progbits,1\\\\n\\" \\".asciz \\\\\\"\\" $_str \\"\\\\\\"\\\\n\\" \\".popsection\\"));
	    }' unless defined(&__SECTIONSTRING);
	}
    } else {
	if((defined(&__STDC__) ? &__STDC__ : undef)) {
	    eval 'sub __SECTIONSTRING {
	        my($_sec, $_str) = @_;
    		eval q( &__asm(\\".pushsection \\" $_sec \\",\\\\\\"MS\\\\\\",@progbits,1\\\\n\\" \\".asciz \\\\\\"\\" $_str \\"\\\\\\"\\\\n\\" \\".popsection\\"));
	    }' unless defined(&__SECTIONSTRING);
	} else {
	    eval 'sub __SECTIONSTRING {
	        my($_sec, $_str) = @_;
    		eval q( &__asm(\\".pushsection \\" $_sec \\",\\\\\\"MS\\\\\\",@progbits,1\\\\n\\" \\".asciz \\\\\\"\\" $_str \\"\\\\\\"\\\\n\\" \\".popsection\\"));
	    }' unless defined(&__SECTIONSTRING);
	}
    }
    eval 'sub __IDSTRING {
        my($_n,$_s) = @_;
	    eval q( &__SECTIONSTRING(. &ident,$_s));
    }' unless defined(&__IDSTRING);
    eval 'sub __RCSID {
        my($_s) = @_;
	    eval q( &__IDSTRING( &rcsid,$_s));
    }' unless defined(&__RCSID);
    eval 'sub __SCCSID {
        my($_s) = @_;
	    eval q();
    }' unless defined(&__SCCSID);
    eval 'sub __SCCSID2 {
        my($_s) = @_;
	    eval q();
    }' unless defined(&__SCCSID2);
    eval 'sub __COPYRIGHT {
        my($_s) = @_;
	    eval q( &__SECTIONSTRING(. &copyright,$_s));
    }' unless defined(&__COPYRIGHT);
    eval 'sub __KERNEL_RCSID {
        my($_n, $_s) = @_;
	    eval q( &__RCSID($_s));
    }' unless defined(&__KERNEL_RCSID);
    eval 'sub __KERNEL_SCCSID {
        my($_n, $_s) = @_;
	    eval q();
    }' unless defined(&__KERNEL_SCCSID);
    eval 'sub __KERNEL_COPYRIGHT {
        my($_n, $_s) = @_;
	    eval q( &__COPYRIGHT($_s));
    }' unless defined(&__KERNEL_COPYRIGHT);
    unless(defined(&__lint__)) {
	eval 'sub __link_set_make_entry {
	    my($set, $sym) = @_;
    	    eval q( &static  &void  &const *  &const  &__link_set_$set &_sym_$sym  &__section(\\"link_set_\\" $set)  &__used = ( &const  &void *)$sym);
	}' unless defined(&__link_set_make_entry);
	eval 'sub __link_set_make_entry2 {
	    my($set, $sym, $n) = @_;
    	    eval q( &static  &void  &const *  &const  &__link_set_$set &_sym_$sym &_$n  &__section(\\"link_set_\\" $set)  &__used = ( &const  &void *)$sym->[$n]);
	}' unless defined(&__link_set_make_entry2);
    } else {
	eval 'sub __link_set_make_entry {
	    my($set, $sym) = @_;
    	    eval q( &extern  &void  &const *  &const  &__link_set_$set &_sym_$sym);
	}' unless defined(&__link_set_make_entry);
	eval 'sub __link_set_make_entry2 {
	    my($set, $sym, $n) = @_;
    	    eval q( &extern  &void  &const *  &const  &__link_set_$set &_sym_$sym &_$n);
	}' unless defined(&__link_set_make_entry2);
    }
    eval 'sub __link_set_add_text {
        my($set, $sym) = @_;
	    eval q( &__link_set_make_entry($set, $sym));
    }' unless defined(&__link_set_add_text);
    eval 'sub __link_set_add_rodata {
        my($set, $sym) = @_;
	    eval q( &__link_set_make_entry($set, $sym));
    }' unless defined(&__link_set_add_rodata);
    eval 'sub __link_set_add_data {
        my($set, $sym) = @_;
	    eval q( &__link_set_make_entry($set, $sym));
    }' unless defined(&__link_set_add_data);
    eval 'sub __link_set_add_bss {
        my($set, $sym) = @_;
	    eval q( &__link_set_make_entry($set, $sym));
    }' unless defined(&__link_set_add_bss);
    eval 'sub __link_set_add_text2 {
        my($set, $sym, $n) = @_;
	    eval q( &__link_set_make_entry2($set, $sym, $n));
    }' unless defined(&__link_set_add_text2);
    eval 'sub __link_set_add_rodata2 {
        my($set, $sym, $n) = @_;
	    eval q( &__link_set_make_entry2($set, $sym, $n));
    }' unless defined(&__link_set_add_rodata2);
    eval 'sub __link_set_add_data2 {
        my($set, $sym, $n) = @_;
	    eval q( &__link_set_make_entry2($set, $sym, $n));
    }' unless defined(&__link_set_add_data2);
    eval 'sub __link_set_add_bss2 {
        my($set, $sym, $n) = @_;
	    eval q( &__link_set_make_entry2($set, $sym, $n));
    }' unless defined(&__link_set_add_bss2);
    eval 'sub __link_set_start {
        my($set) = @_;
	    eval q(( &__start_link_set_$set));
    }' unless defined(&__link_set_start);
    eval 'sub __link_set_end {
        my($set) = @_;
	    eval q(( &__stop_link_set_$set));
    }' unless defined(&__link_set_end);
    eval 'sub __link_set_decl {
        my($set, $ptype) = @_;
	    eval q(\\"(assembly code)\\");
    }' unless defined(&__link_set_decl);
    eval 'sub __link_set_count {
        my($set) = @_;
	    eval q(( &__link_set_end($set) -  &__link_set_start($set)));
    }' unless defined(&__link_set_count);
    if(defined(&_KERNEL)) {
	eval 'sub __read_mostly () { &__attribute__(( &__section__(".data.read_mostly")));}' unless defined(&__read_mostly);
	eval 'sub __cacheline_aligned () { &__attribute__(( &__aligned__( &COHERENCY_UNIT),  &__section__(".data.cacheline_aligned")));}' unless defined(&__cacheline_aligned);
    }
}
1;
