summaryrefslogtreecommitdiffstats
path: root/gcc/crtstuff.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-12-08 18:49:36 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1994-12-08 18:49:36 +0000
commitbaf8c510fb7187e190c9eefd989de8690d218cf4 (patch)
treedba17a0f8a12fa409a181119304f0ea987eeb120 /gcc/crtstuff.c
parent4163086460ef9bbaea4a740d5cbd17993491a206 (diff)
downloadppe42-gcc-baf8c510fb7187e190c9eefd989de8690d218cf4.tar.gz
ppe42-gcc-baf8c510fb7187e190c9eefd989de8690d218cf4.zip
(CRT_END): Add dummy refs to ___brk_addr, __environ and atexit if
__linux__ and __PIC__ defined. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8626 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/crtstuff.c')
-rw-r--r--gcc/crtstuff.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c
index bf1ddb48259..b10a87a3c29 100644
--- a/gcc/crtstuff.c
+++ b/gcc/crtstuff.c
@@ -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 */
OpenPOWER on IntegriCloud