630ea144cb
Per binutils/docs/as/Section.html, COFF assembly, which is what MinGW uses, does not allow @type/%type, which is an ELF-only thing. As a result, trying to assemble the recently modified ctor.S with MinGW produces the error: Error: junk at end of line, first unrecognized character is `,' Fix this by making sure ELF-specifics are only added within ELF-guarded sections. Note: This fixes the now deleted https://sourceforge.net/p/gnu-efi/bugs/38/ Signed-off-by: Pete Batard <pete@akeo.ie>
56 lines
1.2 KiB
ArmAsm
56 lines
1.2 KiB
ArmAsm
/*
|
|
* Try to define the minimal empty init/ctor/dtor/fini_arrays so building with
|
|
* older or out-of-tree linker scripts will still work.
|
|
*/
|
|
/*
|
|
* Note that these aren't using the GNU "CONSTRUCTOR" output section
|
|
* command, so they don't start with a size. Because of p2align and the
|
|
* end/END definitions, and the fact that they're mergeable, they can also
|
|
* have NULLs which aren't guaranteed to be at the end.
|
|
*/
|
|
#if defined(__ELF__)
|
|
.section .init_array,"aw",%init_array
|
|
#else
|
|
.section .init_array,"aw"
|
|
#endif
|
|
.p2align 4, 0
|
|
.globl __init_array_start
|
|
__init_array_start:
|
|
.globl __init_array_end
|
|
__init_array_end:
|
|
#if defined(__ELF__)
|
|
.section .ctors,"aw",%progbits
|
|
#else
|
|
.section .ctors,"aw"
|
|
#endif
|
|
.p2align 4, 0
|
|
.globl __CTOR_LIST__
|
|
__CTOR_LIST__:
|
|
.globl __CTOR_END__
|
|
__CTOR_END__:
|
|
#if defined(__ELF__)
|
|
.section .dtors,"aw",%progbits
|
|
#else
|
|
.section .dtors,"aw"
|
|
#endif
|
|
.p2align 4, 0
|
|
.globl __DTOR_LIST__
|
|
__DTOR_LIST__:
|
|
.globl __DTOR_END__
|
|
__DTOR_END__:
|
|
#if defined(__ELF__)
|
|
.section .fini_array,"aw",%fini_array
|
|
#else
|
|
.section .fini_array,"aw"
|
|
#endif
|
|
.p2align 4, 0
|
|
.globl __fini_array_start
|
|
__fini_array_start:
|
|
.globl __fini_array_end
|
|
__fini_array_end:
|
|
|
|
#if defined(__ELF__) && defined(__linux__)
|
|
.section .note.GNU-stack,"",%progbits
|
|
#endif
|
|
|