during build glibc-2.8 for i486-gnu-linux target i get following linker error: (...) make[3]: Leaving directory `/home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/elf' i486-gnu-linux-gcc -Wl,--hash-style=both -nostdlib -nostartfiles -shared -Wl,-z,now \ -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs -Wl,--verbose 2>&1 | \ LC_ALL=C \ sed -e '/^=========/,/^=========/!d;/^=========/d' \ -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \ > /home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/BUILDDIR/elf/ld.so.lds i486-gnu-linux-gcc -Wl,--hash-style=both -nostdlib -nostartfiles -shared -o /home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/BUILDDIR/elf/ld.so \ -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs -Wl,-z,now \ /home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/BUILDDIR/elf/librtld.os -Wl,--version-script=/home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/BUILDDIR/ld.map \ -Wl,-soname=ld-linux.so.2 -T /home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/BUILDDIR/elf/ld.so.lds /home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/BUILDDIR/elf/librtld.os: In function `_dl_start': rtld.c:(.text+0x3b8): undefined reference to `_begin' /local/devel/toolchain43/i486-gnu-linux.host64/lib/gcc/i486-gnu-linux/4.3.3/../../../../i486-gnu-linux/bin/ld: /home/users/pluto/alatek/toolchain/branches/4.3/glibc-2.8/BUILDDIR/elf/librtld.os: relocation R_386_GOTOFF against undefined hidden symbol `_begin' can not be used when making a shared object /local/devel/toolchain43/i486-gnu-linux.host64/lib/gcc/i486-gnu-linux/4.3.3/../../../../i486-gnu-linux/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status i486-gnu-linux-ld --version GNU ld (Linux/GNU Binutils) 2.19.51.0.2.20090204 note, that previous version (2.19.51.0.1) works fine.
(In reply to comment #0) > sed -e '/^=========/,/^=========/!d;/^=========/d' \ > -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - > SIZEOF_HEADERS;/' \ This command is broken and has already been fixed in the glibc repository.
With GLibC 2.9 snapshot 20090316 I still get the same error using binutils 2.19.51.0.2. Error output below: make[3]: Leaving directory `/mnt/NEWBR/RPM/BUILD/glibc-2.9/elf' i586-altimatos-linux-gnu-gcc -nostdlib -nostartfiles -r -o /mnt/NEWBR/RPM/BUILD/build/elf/librtld.os '-Wl,-(' /mnt/NEWBR/RPM/BUILD/build/elf/dl-allobjs.os /mnt/NEWBR/RPM/BUILD/build/elf/rtld-libc.a -lgcc '-Wl,-)' \ -Wl,-Map,/mnt/NEWBR/RPM/BUILD/build/elf/librtld.os.map i586-altimatos-linux-gnu-gcc -nostdlib -nostartfiles -shared \ -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs -Wl,--verbose 2>&1 | \ LC_ALL=C \ sed -e '/^=========/,/^=========/!d;/^=========/d' \ -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \ > /mnt/NEWBR/RPM/BUILD/build/elf/ld.so.lds i586-altimatos-linux-gnu-gcc -nostdlib -nostartfiles -shared -o /mnt/NEWBR/RPM/BUILD/build/elf/ld.so \ -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs \ /mnt/NEWBR/RPM/BUILD/build/elf/librtld.os -Wl,--version- script=/mnt/NEWBR/RPM/BUILD/build/ld.map \ -Wl,-soname=ld-linux.so.2 -T /mnt/NEWBR/RPM/BUILD/build/elf/ld.so.lds /mnt/NEWBR/RPM/BUILD/build/elf/librtld.os: In function `_dl_start_final': /mnt/NEWBR/RPM/BUILD/glibc-2.9/elf/rtld.c:303: undefined reference to `_begin' /tools/bin/ld: /mnt/NEWBR/RPM/BUILD/build/elf/librtld.os: relocation R_386_GOTOFF against undefined hidden symbol `_begin' can not be used when making a shared object /tools/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status make[2]: *** [/mnt/NEWBR/RPM/BUILD/build/elf/ld.so] Error 1 make[2]: Leaving directory `/mnt/NEWBR/RPM/BUILD/glibc-2.9/elf' make[1]: *** [elf/subdir_lib] Error 2 make[1]: Leaving directory `/mnt/NEWBR/RPM/BUILD/glibc-2.9' make: *** [all] Error 2
This is not a ld bug, it is a glibc one. I believe Adreas when he says it has been fixed, but to be sure I checked the glibc source and indeed it has been fixed.
I'm using the snapshot from the 16th for glibc and I just grabbed binutils 2.19.51.0.3 and I am still getting this. Which version of glibc are you claiming that this works on?
Anything with the following patch: 2009-01-29 Andrew Stubbs <ams@codesourcery.com> * elf/Makefile (ld.so): Adjust the sed script to insert _begin in to newer linker scripts. Current mainline CVS of course has it.
I don't know what you test if you see problems. I'ts long been changed in cvs.