Summary: | [2.33 Regression] Internal error building skiboot for powerpc64-linux-gnu | ||
---|---|---|---|
Product: | binutils | Reporter: | Matthias Klose <doko> |
Component: | ld | Assignee: | Alan Modra <amodra> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 2.33 | ||
Target Milestone: | 2.33 | ||
Host: | Target: | ||
Build: | Last reconfirmed: | ||
Attachments: | test case |
Description
Matthias Klose
2019-06-19 12:20:14 UTC
Created attachment 11848 [details]
test case
This is due to a horrible linker script breaking a new GOT indirect to GOT relative optimisation (git commit 066f4018ae78). ld does a preliminary layout to see whether various optimisations can be done. In this case the preliminary layout indicates that code using a GOT indirect address can be replaced with code calculating a GOT relative address (saving a GOT entry and load from memory). The trouble is that skiboot.lds puts a bunch of dynamic sections between .got and the address in question. Those dynamic sections are not filled out for the preliminary layout, nor can they be since one of the aims of the ppc64 linker optimisation is to reduce dynamic relocations. With the dynamic sections adding over 150kb, the optimisation is no longer valid but ld has already removed the GOT entry. The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bb22a41815facfaa3de621aad5d055eb8e477082 commit bb22a41815facfaa3de621aad5d055eb8e477082 Author: Alan Modra <amodra@gmail.com> Date: Sun Jun 23 12:28:39 2019 +0930 PR24704, Internal error building skiboot for powerpc64-linux-gnu While the skiboot linker script bears some culpability in this PR, it's also true that the GOT indirect to GOT relative optimisation for 16-bit offsets isn't safe. At least, it isn't safe to remove the GOT entry based on distance between the GOT pointer and symbol calculated from the preliminary layout. So this patch removes that optimisation, and reduces the range allowed for 32-bit and 34-bit offsets. PR 24704 bfd/ * elf64-ppc.c (R_PPC64_GOT16_DS): Don't set has_gotrel. (ppc64_elf_edit_toc): Don't remove R_PPC64_GOT16_DS got entries. Reduce range of offsets allowed for other GOT relocs. ld/ * testsuite/ld-powerpc/elfv2exe.d: Update. * testsuite/ld-powerpc/elfv2so.d: Update. Fixed. |