Red Hat Bugzilla – Bug 135498
ld asserts trying to link ppc64 klibc
Last modified: 2007-11-30 17:10:51 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.3; Linux) (KHTML, like Gecko)
Description of problem:
While trying to link klibc-0.181:
ld -m elf64ppc -o tests/environ.shared -e main interp.o tests/environ.o -R libc.so /usr/lib/gcc/ppc64-redhat-linux/3.4.2/64/libgcc.a
ld: BFD 126.96.36.199.2 20040927 assertion fail ../../bfd/elf64-ppc.c:4703
make: *** [tests/environ.shared] Segmentation fault (core dumped)
make: *** Deleting file `tests/environ.shared'
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Try to build klibc-0.181 for ppc64 on rawhide Fedora/ppc.
What klibc is doing, if it ever worked, worked by pure luck.
ld certainly isn't prepared for linking against ET_EXEC objects
as if they were shared libraries.
I guess the best solution would be immediately error out when
trying to link against an executable. The alternative would be
to audit hundreds of abfd->flags & DYNAMIC checks to see whether
EXEC_P bit should also be relevant or not.
I presume you're talking about the -R libc.so bit. What klibc does is
the documented behaviour of ld -R; it imports *only* a symbol table.
Anyway, that is not the problem at hand. Alan Modra has confirmed it
is an "old ABI/new ABI" thing, and it also affects the kernel.
Specifying -mcall-aixdesc to gcc makes it work by using the "old ABI".
Oops, I have missed the -R there, sorry about that.
Alan Modra's patch is in binutils-188.8.131.52.2-5.