diff options
author | Florian Weimer <fweimer@redhat.com> | 2021-12-05 13:50:17 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2021-12-05 13:50:21 +0100 |
commit | 4fb4e7e821e36180835bf88e363f9f13b5797e3a (patch) | |
tree | e315c682e44885fe627ad0a2d10d006fef8ee140 /csu/gmon-start.c | |
parent | c1cb2deeca1a85c6fc5bd41b90816d48a95bc434 (diff) | |
download | glibc-4fb4e7e821e36180835bf88e363f9f13b5797e3a.tar.gz glibc-4fb4e7e821e36180835bf88e363f9f13b5797e3a.tar.xz glibc-4fb4e7e821e36180835bf88e363f9f13b5797e3a.zip |
csu: Always use __executable_start in gmon-start.c
Current binutils defines __executable_start as the lowest text address, so using the entry point address as a fallback is no longer necessary. As a result, overriding <entry.h> is only necessary if the entry point is not called _start. The previous approach to define __ASSEMBLY__ to suppress the declaration breaks if headers included by <entry.h> are not compatible with __ASSEMBLY__. This happens with rseq integration because it is necessary to include kernel headers in more places. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'csu/gmon-start.c')
-rw-r--r-- | csu/gmon-start.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/csu/gmon-start.c b/csu/gmon-start.c index 344606a676..260c7613e2 100644 --- a/csu/gmon-start.c +++ b/csu/gmon-start.c @@ -38,32 +38,12 @@ #include <stdlib.h> #include <unistd.h> #include <elf-initfini.h> -#define __ASSEMBLY__ -#include <entry.h> - -/* Beginning and end of our code segment. We cannot declare them - as the external functions since we want the addresses of those - labels. Taking the address of a function may have different - meanings on different platforms. */ -#ifdef ENTRY_POINT_DECL -ENTRY_POINT_DECL(extern) -#else -extern char ENTRY_POINT[]; -#endif -extern char etext[]; /* Use __executable_start as the lowest address to keep profiling records if it provided by the linker. */ -extern const char executable_start[] asm ("__executable_start") - __attribute__ ((weak, visibility ("hidden"))); +extern const char __executable_start[] __attribute__ ((visibility ("hidden"))); -#ifndef TEXT_START -# ifdef ENTRY_POINT_DECL -# define TEXT_START ENTRY_POINT -# else -# define TEXT_START &ENTRY_POINT -# endif -#endif +extern char etext[]; #if !ELF_INITFINI /* Instead of defining __gmon_start__ globally in gcrt1.o, we make it @@ -97,10 +77,7 @@ __gmon_start__ (void) called = 1; /* Start keeping profiling records. */ - if (&executable_start != NULL) - __monstartup ((u_long) &executable_start, (u_long) &etext); - else - __monstartup ((u_long) TEXT_START, (u_long) &etext); + __monstartup ((u_long) &__executable_start, (u_long) &etext); /* Call _mcleanup before exiting; it will write out gmon.out from the collected data. */ |