OSDN Git Service

(CRT_END): Add dummy refs to ___brk_addr, __environ and atexit if
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Dec 1994 18:49:36 +0000 (18:49 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Dec 1994 18:49:36 +0000 (18:49 +0000)
__linux__ and __PIC__ defined.

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

gcc/crtstuff.c

index bf1ddb4..b10a87a 100644 (file)
@@ -3,7 +3,7 @@
 
    Written by Ron Guilmette (rfg@netcom.com) with help from Richard Stallman.
 
-Copyright (C) 1991 Free Software Foundation, Inc.
+Copyright (C) 1991, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -235,6 +235,21 @@ init_dummy ()
   FORCE_INIT_SECTION_ALIGN;
 #endif
   asm (TEXT_SECTION_ASM_OP);
+
+/* This is a kludge. The Linux dynamic linker needs  ___brk_addr, __environ
+   and atexit (). We have to make sure they are in the .dynsym section. We
+   accomplish it by making a dummy call here. This
+   code is never reached. */
+#if defined(__linux__) && defined(__PIC__)
+  {
+    extern void *___brk_addr;
+    extern char **__environ;
+
+    ___brk_addr = __environ;
+    atexit ();
+  }
+#endif
 }
 
 #else  /* OBJECT_FORMAT_ELF */