* Makefile.in (libgcc2): Pass MAYBE_USE_COLLECT2 as an argument.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Jun 1999 03:12:22 +0000 (03:12 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Jun 1999 03:12:22 +0000 (03:12 +0000)
        * libgcc2.c (__CTOR_LIST, __DTOR_LIST); Do not provide
        initializers is some circumstances.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27489 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/libgcc2.c

index 4d818f6..ce58938 100644 (file)
@@ -1,5 +1,9 @@
 Fri Jun 11 03:17:51 1999  Jeffrey A Law  (law@cygnus.com)
 
+       * Makefile.in (libgcc2): Pass MAYBE_USE_COLLECT2 as an argument.
+       * libgcc2.c (__CTOR_LIST, __DTOR_LIST); Do not provide
+       initializers is some circumstances.
+
        * fixinc/inclhack.def (endif_label): Add additional selector for
        more bogus stuff after #endif statements.
        * fixinc/inclhack.sh, fixinc/fixincl.x: Rebuilt.
index 20b832a..3b79e41 100644 (file)
@@ -393,6 +393,9 @@ EXTRA_HEADERS =@extra_headers_list@
 
 # Set this to `collect2' to enable use of collect2.
 USE_COLLECT2 = @will_use_collect2@
+# If we might be using collect2, then this variable will be set to
+# -DUSE_COLLECT2.  toplev.c, collect2.c and libgcc2.c all need to
+# if we may be using collect2.
 MAYBE_USE_COLLECT2 = @maybe_use_collect2@
 # It is convenient for configure to add the assignment at the beginning,
 # so don't override it here.
@@ -1067,7 +1070,7 @@ libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \
        do \
          echo $${name}; \
          $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
-             $(srcdir)/libgcc2.c -o $${name}$(objext); \
+             $(MAYBE_USE_COLLECT2) $(srcdir)/libgcc2.c -o $${name}$(objext); \
          if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
          $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) tmplibgcc2.a $${name}$(objext); \
          rm -f $${name}$(objext); \
index a902dd3..6d8fb0b 100644 (file)
@@ -2903,17 +2903,26 @@ SYMBOL__MAIN ()
 #include "gbl-ctors.h"
 
 /* Provide default definitions for the lists of constructors and
-   destructors, so that we don't get linker errors.  
-
-   The old code sometimes put these into the data segment and sometimes
-   into the bss segment.  Putting these into the data segment should always
-   work and avoids a little bit of complexity.  */
+   destructors, so that we don't get linker errors.  These symbols are
+   intentionally bss symbols, so that gld and/or collect will provide
+   the right values.  */
 
 /* We declare the lists here with two elements each,
-   so that they are valid empty lists if no other definition is loaded.  */
+   so that they are valid empty lists if no other definition is loaded.
+
+   If we are using the old "set" extensions to have the gnu linker
+   collect ctors and dtors, then we __CTOR_LIST__ and __DTOR_LIST__
+   must be in the bss/common section.
+
+   Long term no port should use those extensions.  But many still do.  */
 #if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
+#if defined (ASM_OUTPUT_CONSTRUCTOR) || defined (USE_COLLECT2)
 func_ptr __CTOR_LIST__[2] = {0, 0};
 func_ptr __DTOR_LIST__[2] = {0, 0};
+#else
+func_ptr __CTOR_LIST__[2];
+func_ptr __DTOR_LIST__[2];
+#endif
 #endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
 #endif /* L_ctors */
 \f