diff options
author | kettenis <kettenis@openbsd.org> | 2020-11-21 14:15:17 +0000 |
---|---|---|
committer | kettenis <kettenis@openbsd.org> | 2020-11-21 14:15:17 +0000 |
commit | 3bed555d972290e3a0ca1308c50019abea07909c (patch) | |
tree | 32db08b6cbcbb474e12443e1cba1c8a2f9849e74 /gnu | |
parent | Restructure cache flush operations to avoid repeated barriers. Specifically (diff) | |
download | wireguard-openbsd-3bed555d972290e3a0ca1308c50019abea07909c.tar.xz wireguard-openbsd-3bed555d972290e3a0ca1308c50019abea07909c.zip |
Backport https://reviews.llvm.org/D75419. This adds a workaround for
undefined references to .got2 on powerpc making it possible to link
llvm with lld.
ok gkoehler@
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/llvm/lld/ELF/InputSection.cpp | 5 | ||||
-rw-r--r-- | gnu/llvm/lld/ELF/Relocations.cpp | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gnu/llvm/lld/ELF/InputSection.cpp b/gnu/llvm/lld/ELF/InputSection.cpp index d34abf641ed..8613e0d68e6 100644 --- a/gnu/llvm/lld/ELF/InputSection.cpp +++ b/gnu/llvm/lld/ELF/InputSection.cpp @@ -438,11 +438,12 @@ void InputSection::copyRelocations(uint8_t *buf, ArrayRef<RelTy> rels) { // hopefully creates a frame that is ignored at runtime. Also, don't warn // on .gcc_except_table and debug sections. // - // See the comment in maybeReportUndefined for PPC64 .toc . + // See the comment in maybeReportUndefined for PPC32 .got2 and PPC64 .toc auto *d = dyn_cast<Defined>(&sym); if (!d) { if (!isDebugSection(*sec) && sec->name != ".eh_frame" && - sec->name != ".gcc_except_table" && sec->name != ".toc") { + sec->name != ".gcc_except_table" && sec->name != ".got2" && + sec->name != ".toc") { uint32_t secIdx = cast<Undefined>(sym).discardedSecIdx; Elf_Shdr_Impl<ELFT> sec = CHECK(file->getObj().sections(), file)[secIdx]; diff --git a/gnu/llvm/lld/ELF/Relocations.cpp b/gnu/llvm/lld/ELF/Relocations.cpp index 93ec0661071..8d3cdba15bd 100644 --- a/gnu/llvm/lld/ELF/Relocations.cpp +++ b/gnu/llvm/lld/ELF/Relocations.cpp @@ -926,8 +926,12 @@ static bool maybeReportUndefined(Symbol &sym, InputSectionBase &sec, // .toc and the .rela.toc are incorrectly not placed in the comdat. The ELF // spec says references from outside the group to a STB_LOCAL symbol are not // allowed. Work around the bug. - if (config->emachine == EM_PPC64 && - cast<Undefined>(sym).discardedSecIdx != 0 && sec.name == ".toc") + // + // PPC32 .got2 is similar but cannot be fixed. Multiple .got2 is infeasible + // because .LC0-.LTOC is not representable if the two labels are in different + // .got2 + if (cast<Undefined>(sym).discardedSecIdx != 0 && + (sec.name == ".got2" || sec.name == ".toc")) return false; bool isWarning = |