aboutsummaryrefslogtreecommitdiff
path: root/gcc/crtstuff.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-12-08 13:49:36 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-12-08 13:49:36 -0500
commitbced43dd6ca22ea9d76ed6b5cd75e2f8f6af4972 (patch)
treedba17a0f8a12fa409a181119304f0ea987eeb120 /gcc/crtstuff.c
parent38d8473fbb1188149c6824a92ddebf34f06a56f2 (diff)
downloadgcc-bced43dd6ca22ea9d76ed6b5cd75e2f8f6af4972.zip
gcc-bced43dd6ca22ea9d76ed6b5cd75e2f8f6af4972.tar.gz
gcc-bced43dd6ca22ea9d76ed6b5cd75e2f8f6af4972.tar.bz2
(CRT_END): Add dummy refs to ___brk_addr, __environ and atexit if
__linux__ and __PIC__ defined. From-SVN: r8626
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 bf1ddb4..b10a87a 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 */