This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Don't let mips-elf provide __CTOR_LIST__ in libgcc


Hi Gavin,

I was told to send this straight to you rather than gcc-patches. It was
originally sent in January so it had aged enough for me to resend it :-).

Jifl


-----Original Message------

The rationale behind this change is that either __CTOR_LIST__ should come
from crtbegin.o or the user will provide it. There is no need to rely on
libgcc to provide it.

If left as-is, then it becomes impossible for people who define
__CTOR_LIST__ in linker scripts rather than by magic .o files at the start
of the link line to get the list right. The reason is that two null entries
get placed somewhere in the middle of the __CTOR_LIST__ depending on where
the first reference to __CTOR_LIST__ in the linked .o files came from.

Ta,

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS   Tel: +44 (1223) 728762
"I used to have an open mind but || Get yer free open source RTOS's here...
 my brains kept falling out."    || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/  These opinions are all my own fault
Tue Jan 25 14:41:45 2000  Jonathan Larmour  <jlarmour@cygnus.co.uk>
 
        * config/mips/elf.h (CTOR_LISTS_DEFINED_EXTERNALLY): Define because
        __CTOR_LIST__ always comes from either crtbegin.o or equivalent, or
        directly from the user if they chose to override it
                                                                                             
Index: config/mips/elf.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/mips/elf.h,v
retrieving revision 1.24.16.3
diff -u -5 -p -r1.24.16.3 elf.h
--- elf.h	1999/12/07 14:04:59	1.24.16.3
+++ elf.h	2000/01/25 14:50:06
@@ -288,10 +288,15 @@ do {									   \
    via the SHF_WRITE attribute.)  */
 
 #define CTORS_SECTION_ASM_OP    "\t.section\t.ctors,\"aw\""
 #define DTORS_SECTION_ASM_OP    "\t.section\t.dtors,\"aw\""
  
+/* There's no point providing a default definition of __CTOR_LIST__
+   since people are expected either to use crtbegin.o, or an equivalent,
+   or provide their own definition.  */
+#define CTOR_LISTS_DEFINED_EXTERNALLY
+
 /* A list of other sections which the compiler might be "in" at any
    given time.  */
 #undef EXTRA_SECTIONS
 #define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata, in_ctors, in_dtors
  
@@ -375,13 +380,10 @@ void FN ()                              
 #ifdef IN_LIBGCC2
 /* We must also declare them 'extern' for libgcc.a, or they will
    be referenced as if they were in .sdata.  */
 extern unsigned char __attribute__((section(".eh_frame"))) 
      __EH_FRAME_BEGIN__[];
-extern void (* __attribute__((section(".ctors"))) __CTOR_LIST__[])();
-     
-extern void (* __attribute__((section(".dtors"))) __DTOR_LIST__[])();
 #endif
 
 /* Don't set the target flags, this is done by the linker script */
 #undef LIB_SPEC
 #define LIB_SPEC ""


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]