This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: atexit bug, RFC
- To: Ben Collins <bcollins at debian dot org>
- Subject: Re: atexit bug, RFC
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Mon, 26 Mar 2001 12:07:55 -0800
- Cc: GNU C Library <libc-alpha at sourceware dot cygnus dot com>
- References: <20010326141545.R23268@visi.net>
On Mon, Mar 26, 2001 at 02:15:45PM -0500, Ben Collins wrote:
> I'm experiencing a bug with current CVS. Although I'm sure it's
> binutils, I wanted some feedback about what works with other people.
> Currently I am using gcc 2.95.3 + weak-sym patch, binutils
> 2.11.90.0.1, and obviously current glibc CVS. The bug is that a shared
> library built against the latest glibc, when linked to by compiling
> another program, fails to link missing the atexit symbol.
>
Don't use 2.95.3 with the latest glibc:
http://gcc.gnu.org/ml/gcc/2001-03/msg00879.html
I am enclosing the patch for 2.95.3 here:
H.J.
-----
2001-03-21 Jakub Jelinek <jakub@redhat.com>
* crtstuff.c (init_dummy): Use CRT_END_INIT_DUMMY if defined.
Remove ia32 linux PIC kludge and move it...
* config/i386/linux.h (CRT_END_INIT_DUMMY): ...here.
Index: crtstuff.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/crtstuff.c,v
retrieving revision 1.32
retrieving revision 1.32.4.1
diff -u -p -r1.32 -r1.32.4.1
--- gcc/crtstuff.c 2001/01/28 01:50:05 1.32
+++ gcc/crtstuff.c 2001/03/21 09:50:37 1.32.4.1
@@ -413,20 +413,8 @@ init_dummy (void)
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 (0);
- }
+#ifdef CRT_END_INIT_DUMMY
+ CRT_END_INIT_DUMMY;
#endif
}
Index: config/i386/linux.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/linux.h,v
retrieving revision 1.22
retrieving revision 1.22.4.1
diff -u -p -r1.22 -r1.22.4.1
--- gcc/config/i386/linux.h 2001/01/09 22:10:53 1.22
+++ gcc/config/i386/linux.h 2001/03/21 09:50:37 1.22.4.1
@@ -169,3 +169,21 @@ Boston, MA 02111-1307, USA. */
} \
} 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