From 4fb4e7e821e36180835bf88e363f9f13b5797e3a Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sun, 5 Dec 2021 13:50:17 +0100 Subject: 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 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 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 --- csu/gmon-start.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) (limited to 'csu') 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 #include #include -#define __ASSEMBLY__ -#include - -/* 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. */ -- cgit 1.4.1