diff options
| author | Martin Storsjo <martin@martin.st> | 2018-09-30 18:31:03 +0000 |
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2018-09-30 18:31:03 +0000 |
| commit | 0f8f0d6d1df8d17765ea5b34b117d85142b2bf24 (patch) | |
| tree | 4cd6ca2f37ef0e8c11f73439dc771650e886cddc /lld/COFF/Chunks.cpp | |
| parent | b1108399bd66ba9703f6bc671764a6f168f1138b (diff) | |
| download | bcm5719-llvm-0f8f0d6d1df8d17765ea5b34b117d85142b2bf24.tar.gz bcm5719-llvm-0f8f0d6d1df8d17765ea5b34b117d85142b2bf24.zip | |
[COFF] In MinGW mode, ignore relocations against a discarded section
When GCC produces a jump table as part of a comdat function, the
jump table itself is produced as plain non-comdat rdata section. When
linked with ld.bfd, all of those rdata sections are kept, with
relocations unchanged in the sections that refer to discarded comdat
sections.
This has been observed with at least GCC 5.x and 7.x.
Differential Revision: https://reviews.llvm.org/D52600
llvm-svn: 343422
Diffstat (limited to 'lld/COFF/Chunks.cpp')
| -rw-r--r-- | lld/COFF/Chunks.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp index dc471117981..eb90bd7ba77 100644 --- a/lld/COFF/Chunks.cpp +++ b/lld/COFF/Chunks.cpp @@ -351,7 +351,12 @@ void SectionChunk::writeTo(uint8_t *Buf) const { check(File->getCOFFObj()->getSymbol(Rel.SymbolTableIndex)); StringRef Name; File->getCOFFObj()->getSymbolName(Sym, Name); - error("relocation against symbol in discarded section: " + Name); + + // MinGW mode object files (built by GCC) can have leftover sections + // with relocations against discarded comdat sections. Such sections + // are left as is, with relocations untouched. + if (!Config->MinGW) + error("relocation against symbol in discarded section: " + Name); continue; } // Get the output section of the symbol for this relocation. The output |

