From 0d6378a9e3e589217fda7be9ae273aee14540fe0 Mon Sep 17 00:00:00 2001 From: jakub Date: Sat, 15 Dec 2001 11:49:18 +0000 Subject: * configure.in: Check for ld. (HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option. * configure, config.in: Rebuilt. * config.gcc: Add crtbeginT.o to extra_parts where needed. * config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc frame unwinding on Linux. * config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde frame unwinding. * config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static. (LINK_EH_SPEC): Define. * config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static. * config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define. * config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't iterate further if pc falls into current library, but fde was not found. * config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static if using glibc. (LINK_EH_SPEC): Define. * config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64): Use crtbeginT.o for -static. (LINK_EH_SPEC): Define. * config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o. * Makefile.in (crtbeginT.o): Add rule. * gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh. If neither -static-libgcc nor -shared-libgcc is passed and -shared, use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not. If none of the above switches are passed, use -lgcc -lgcc_eh. (init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec. * mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if creating libgcc_s.so, put them into separate libgcc_eh.a instead. * unwind-dw2-fde.c: Don't include any headers if this file is included from other .c file. * unwind-dw2-fde-glibc.c: New file. * crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define. Use it instead of EH_FRAME_SECTION_NAME where appropriate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48039 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/crtstuff.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'gcc/crtstuff.c') diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index dae5190f904..8beb64cf51c 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -66,6 +66,19 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA # define CRT_CALL_STATIC_FUNCTION(func) func () #endif +#if defined(OBJECT_FORMAT_ELF) && defined(HAVE_LD_EH_FRAME_HDR) \ + && !defined(CRTSTUFFT_O) \ + && defined(__GLIBC__) && __GLIBC__ >= 2 +#include +# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \ + || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) +# define USE_PT_GNU_EH_FRAME +# endif +#endif +#if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME) +# define USE_EH_FRAME_REGISTRY +#endif + /* We do not want to add the weak attribute to the declarations of these routines in unwind-dw2-fde.h because that will cause the definition of these symbols to be weak as well. @@ -245,7 +258,7 @@ __do_global_dtors_aux (void) f (); } -#ifdef EH_FRAME_SECTION_NAME +#ifdef USE_EH_FRAME_REGISTRY #if defined(CRT_GET_RFIB_TEXT) || defined(CRT_GET_RFIB_DATA) /* If we used the new __register_frame_info_bases interface, make sure that we deregister from the same place. */ @@ -274,7 +287,7 @@ fini_dummy (void) asm (TEXT_SECTION_ASM_OP); } -#if defined(EH_FRAME_SECTION_NAME) || defined(JCR_SECTION_NAME) +#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME) /* Stick a call to __register_frame_info into the .init section. For some reason calls with no arguments work more reliably in .init, so stick the call in another function. */ @@ -282,7 +295,7 @@ fini_dummy (void) static void frame_dummy (void) { -#ifdef EH_FRAME_SECTION_NAME +#ifdef USE_EH_FRAME_REGISTRY static struct object object; #if defined(CRT_GET_RFIB_TEXT) || defined(CRT_GET_RFIB_DATA) void *tbase, *dbase; @@ -386,13 +399,13 @@ __do_global_dtors (void) for (p = __DTOR_LIST__ + 1; (f = *p); p++) f (); -#ifdef EH_FRAME_SECTION_NAME +#ifdef USE_EH_FRAME_REGISTRY if (__deregister_frame_info) __deregister_frame_info (__EH_FRAME_BEGIN__); #endif } -#if defined(EH_FRAME_SECTION_NAME) || defined(JCR_SECTION_NAME) +#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME) /* A helper function for __do_global_ctors, which is in crtend.o. Here in crtbegin.o, we can reference a couple of symbols not visible there. Plus, since we're before libgcc.a, we have no problems referencing @@ -400,7 +413,7 @@ __do_global_dtors (void) void __do_global_ctors_1(void) { -#ifdef EH_FRAME_SECTION_NAME +#ifdef USE_EH_FRAME_REGISTRY static struct object object; if (__register_frame_info) __register_frame_info (__EH_FRAME_BEGIN__, &object); @@ -547,7 +560,7 @@ void __do_global_ctors (void) { func_ptr *p; -#if defined(EH_FRAME_SECTION_NAME) || defined(JCR_SECTION_NAME) +#if defined(USE_EH_FRAME_REGISTRY) || defined(JCR_SECTION_NAME) __do_global_ctors_1(); #endif for (p = __CTOR_END__ - 1; *p != (func_ptr) -1; p--) -- cgit v1.2.3