Commit bced43dd by Richard Kenner

(CRT_END): Add dummy refs to ___brk_addr, __environ and atexit if

__linux__ and __PIC__ defined.

From-SVN: r8626
parent 38d8473f
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Written by Ron Guilmette (rfg@netcom.com) with help from Richard Stallman. 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. This file is part of GNU CC.
...@@ -235,6 +235,21 @@ init_dummy () ...@@ -235,6 +235,21 @@ init_dummy ()
FORCE_INIT_SECTION_ALIGN; FORCE_INIT_SECTION_ALIGN;
#endif #endif
asm (TEXT_SECTION_ASM_OP); 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 */ #else /* OBJECT_FORMAT_ELF */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment