[uClibc] [buildroot] __brk_addr with gcc 2.95.3 undefined

Philippe Ney philippe.ney at pardes.ws
Fri Aug 12 12:10:28 UTC 2005


Hi,

When building e2fsprogs with gcc-2.95.3, I have the following error


make[3]: Entering directory
`/home/philippe/SEBOX/y5/build_i386/e2fsprogs-1.37/lib/uuid'
        LD uuid_time
../../lib/libuuid.so: undefined reference to `___brk_addr'
collect2: ld returned 1 exit status


My packages environment are the following

binutils-2.16.1.tar.bz2
gcc-2.95.3.tar.gz
busybox-1.00.tar.bz2
e2fsprogs-1.37.tar.gz
uClibc-0.9.27.tar.bz2
linux-libc-headers-2.6.8.1.tar.bz2


When I use gcc 3.4.2, there isn't any problem.

I found something about __brk_addr in the gcc-2.95.3-2.patch from LFS 5.0
and apply part of it :


--- gcc-2.95.3.orig/gcc/config/i386/linux.h	Thu Apr  8 10:32:13 1999
+++ gcc-2.95.3/gcc/config/i386/linux.h	Sat Aug 18 07:18:42 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


But without the ifdef/endif directive to be sure __brk_addr is defined.

And even with that it don't build :

[...]
        LD uuid_time
../../lib/libuuid.so: undefined reference to `___brk_addr'
collect2: ld returned 1 exit status


Did someone know how to correct this problem ?

Thanks a lot in advance,
Philippe





More information about the uClibc mailing list