With a powerpc64le allyesconfig build of the Linux kernel, using thin archives and --gc-sections, I see ld failing: npiggin@p84-npiggin:~/src/linux$ time ../binutils/binutils-gdb/ld/ld-new -EL -m elf64lppc -pie --emit-relocs --build-id --gc-sections -X -o vmlinux -T ./arch/powerpc/kernel/vmlinux.lds --whole-archive built-in.o .tmp_kallsyms3.o ../binutils/binutils-gdb/ld/ld-new: BFD (GNU Binutils) 2.27.51.20160819 internal error, aborting at elf64-ppc.c:14898 in ppc64_elf_relocate_section Bisected to d311bc8bf85f8358df21301fe8a357aa1212f80c This build requires some out of tree patches to the kernel, so I can test patches and report back, or for IBMers I can give a login to my VM if that would help.
Confirmed to fail with head of tree as of Aug 26, commit 980aa3e6dfeb0f018915f65be4b2987667f31fe9
Confirmed this does not require any kernel modifications, a large kernel, or --gc-sections or --emit-relocs etc. Standard upstream Linux kernel with minimal config reproduces the error.
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8a9e8e72fe88095043d16f8a56b5a1e150ee288b commit 8a9e8e72fe88095043d16f8a56b5a1e150ee288b Author: Alan Modra <amodra@gmail.com> Date: Sat Aug 27 08:59:29 2016 +0930 Fix commit 980aa3e6 Commit 980aa3e6 was supposed to cure dyn_reloc counting problems, but did the opposite. For PIC we count two types of dyn_reloc, those on pc-relative relocs, and the total. If a sym needs pc-relative dyn relocs then all the relocs are dynamic. If not, then only those that are must_be_dyn_reloc are dynamic. PR 20519 * elf64-ppc.c (pc_dynrelocs): New function. (ppc64_elf_relocate_section): Use it and must_be_dyn_reloc to handle pic dynamic relocs.
Fixed, I think.
Yes this works now, thank you.
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b1b07054c08eea65ba8d1a9f771796d686f337e5 commit b1b07054c08eea65ba8d1a9f771796d686f337e5 Author: Alan Modra <amodra@gmail.com> Date: Tue Mar 7 11:04:19 2017 +1030 PowerPC64 abort due to dynamic relocs on hidden undefweak ppc64_elf_relocate_section lacked a check which meant that it emitted dynamic relocs against a hidden undefweak symbol for which no dynamic relocs had been allocated. PR 21224 PR 20519 * elf64-ppc.c (ppc64_elf_relocate_section): Add missing dyn_relocs check.
The binutils-2_28-branch branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d69827324f704b75ac7e5c2b39219cdd15e790b commit 0d69827324f704b75ac7e5c2b39219cdd15e790b Author: Alan Modra <amodra@gmail.com> Date: Tue Mar 7 11:04:19 2017 +1030 PowerPC64 abort due to dynamic relocs on hidden undefweak ppc64_elf_relocate_section lacked a check which meant that it emitted dynamic relocs against a hidden undefweak symbol for which no dynamic relocs had been allocated. PR 21224 PR 20519 * elf64-ppc.c (ppc64_elf_relocate_section): Add missing dyn_relocs check.