diff options
Diffstat (limited to 'csu')
-rw-r--r-- | csu/elf-init.c | 7 | ||||
-rw-r--r-- | csu/gmon-start.c | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/csu/elf-init.c b/csu/elf-init.c index b713c8b..98b3f11 100644 --- a/csu/elf-init.c +++ b/csu/elf-init.c @@ -34,6 +34,7 @@ <https://www.gnu.org/licenses/>. */ #include <stddef.h> +#include <elf-initfini.h> /* These magic symbols are provided by the linker. */ @@ -49,7 +50,7 @@ extern void (*__fini_array_start []) (void) attribute_hidden; extern void (*__fini_array_end []) (void) attribute_hidden; -#ifndef NO_INITFINI +#if ELF_INITFINI /* These function symbols are provided for the .init/.fini section entry points automagically by the linker. */ extern void _init (void); @@ -79,7 +80,7 @@ __libc_csu_init (int argc, char **argv, char **envp) } #endif -#ifndef NO_INITFINI +#if ELF_INITFINI _init (); #endif @@ -99,7 +100,7 @@ __libc_csu_fini (void) while (i-- > 0) (*__fini_array_start [i]) (); -# ifndef NO_INITFINI +# if ELF_INITFINI _fini (); # endif #endif diff --git a/csu/gmon-start.c b/csu/gmon-start.c index 2803be3..da9f04c 100644 --- a/csu/gmon-start.c +++ b/csu/gmon-start.c @@ -37,6 +37,7 @@ #include <sys/gmon.h> #include <stdlib.h> #include <unistd.h> +#include <elf-initfini.h> #define __ASSEMBLY__ #include <entry.h> @@ -59,6 +60,13 @@ extern char etext[]; # endif #endif +#if !ELF_INITFINI +/* Instead of defining __gmon_start__ globally in gcrt1.o, we make it + static and just put a pointer to it into the .preinit_array + section. */ +# define GMON_START_ARRAY_SECTION ".preinit_array" +#endif + #ifdef GMON_START_ARRAY_SECTION static void __gmon_start__ (void); static void (*const gmon_start_initializer) (void) |