diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-01 09:50:46 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-02 14:06:20 +0000 |
commit | e55d4988880a538fa81fe6bb2bf4fd5604174f06 (patch) | |
tree | 152cf191dc78eaffaf6a45db8dc5fb00b3300843 | |
parent | 7cb503fd746b80c8613a3e76dde93aedb6e75830 (diff) | |
download | syslinux-e55d4988880a538fa81fe6bb2bf4fd5604174f06.tar.gz syslinux-e55d4988880a538fa81fe6bb2bf4fd5604174f06.tar.xz syslinux-e55d4988880a538fa81fe6bb2bf4fd5604174f06.zip |
com32: Include .init_array section in .ctors in linker script
GCC 4.7 now places pointers to functions with the 'constructor' and
'destructor' function attributes in .init_array and .fini_array
sections, respectively, whereas previously they were in the .ctors and
.dtors sections. This change breaks the ctors/dtors code as it only
expects function to be in the .ctors and .dtors sections, meaning the
ctors and dtors functions are never executed.
While a COM32_INIT() macro exists that places functions in the
.init_array section, no function makes use of it, so there should be
no fallout from this change.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | com32/lib/elf32.ld | 15 | ||||
-rw-r--r-- | com32/lib/init.h | 15 | ||||
-rw-r--r-- | com32/lib/malloc.c | 1 |
3 files changed, 4 insertions, 27 deletions
diff --git a/com32/lib/elf32.ld b/com32/lib/elf32.ld index ddf6e048..16d10a38 100644 --- a/com32/lib/elf32.ld +++ b/com32/lib/elf32.ld @@ -75,17 +75,6 @@ SECTIONS { KEEP (*(.preinit_array)) } - .init_array : - { - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - } - .fini_array : - { - KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) - } - .ctors : { __ctors_start = .; @@ -93,6 +82,8 @@ SECTIONS KEEP (*(.ctors)) KEEP (*(.ctors_modinit)) KEEP (*(.ctors_modmain)) + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) __ctors_end = .; } @@ -102,6 +93,8 @@ SECTIONS KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) KEEP (*(.dtors_modexit)) + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) __dtors_end = .; } diff --git a/com32/lib/init.h b/com32/lib/init.h deleted file mode 100644 index 2d983427..00000000 --- a/com32/lib/init.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * init.h - * - * Magic to set up initializers - */ - -#ifndef _INIT_H -#define _INIT_H 1 - -#include <inttypes.h> - -#define COM32_INIT(x) static const void * const __COM32_INIT \ - __attribute__((section(".init_array"),unused)) = (const void * const)&x - -#endif /* _INIT_H */ diff --git a/com32/lib/malloc.c b/com32/lib/malloc.c index ec103ab3..ce35f3d1 100644 --- a/com32/lib/malloc.c +++ b/com32/lib/malloc.c @@ -8,7 +8,6 @@ #include <string.h> #include <com32.h> #include <syslinux/memscan.h> -#include "init.h" #include "malloc.h" struct free_arena_header __malloc_head = { |