[PATCH] D52600: [LLD] [COFF] In MinGW mode, ignore relocations against a discarded section

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 04:18:10 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: ruiu, rnk, pcc.

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 GCC 5.x and 7.x.

I know this change is extremely ugly, but I don't really know what else to do about it...

I know I earlier said support for linking GCC produced object files with LLD was a non-goal. After getting support for GNU import libraries and GNU ld compatible __CTOR_LIST__, using LLD as an actual drop-in replacement for GNU ld in existing setups with GCC actually is totally viable though.

With these three patches, I'm able to link clang.exe with LLD, out of object files compiled with GCC.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D52600

Files:
  COFF/Chunks.cpp
  test/COFF/Inputs/comdat-jumptable2.s
  test/COFF/comdat-jumptable.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52600.167271.patch
Type: text/x-patch
Size: 4115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180927/cf77b7be/attachment.bin>


More information about the llvm-commits mailing list