diff -urN gcc-2.95.3.org/gcc/config/i386/linux.h gcc-2.95.3/gcc/config/i386/linux.h --- gcc-2.95.3.org/gcc/config/i386/linux.h Mon Mar 19 19:35:22 2001 +++ gcc-2.95.3/gcc/config/i386/linux.h Mon Mar 19 19:36:46 2001 @@ -234,3 +234,21 @@ } \ } while (0) #endif + +#if defined(__PIC__) && defined (USE_GNULIBC_1) +/* This is a kludge. The i386 GNU/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. */ + +#define CRT_END_INIT_DUMMY \ + do \ + { \ + extern void *___brk_addr; \ + extern char **__environ; \ + \ + ___brk_addr = __environ; \ + atexit (0); \ + } \ + while (0) +#endif diff -urN gcc-2.95.3.org/gcc/crtstuff.c gcc-2.95.3/gcc/crtstuff.c --- gcc-2.95.3.org/gcc/crtstuff.c Mon Mar 19 19:35:22 2001 +++ gcc-2.95.3/gcc/crtstuff.c Mon Mar 19 19:37:56 2001 @@ -379,20 +379,8 @@ FORCE_INIT_SECTION_ALIGN; #endif asm (TEXT_SECTION_ASM_OP); - -/* This is a kludge. The i386 GNU/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__) && defined(__i386__) - { - extern void *___brk_addr; - extern char **__environ; - - ___brk_addr = __environ; - atexit (); - } +#ifdef CRT_END_INIT_DUMMY + CRT_END_INIT_DUMMY; #endif }