[PATCH] D83244: [lld] Don't error out on relocations in .gcc_except_table to discarded sections.

Hafiz Abid Qadeer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 02:03:06 PDT 2020


abidh added a comment.

In D83244#2133669 <https://reviews.llvm.org/D83244#2133669>, @MaskRay wrote:

> The `.eh_frame` test case is invalid. LLD handles .eh_frame input sections differently. It parses .eh_frame and deduplicates them. See `eh-frame-merge.s`, an input .eh_frame referencing a non-prevailing COMDAT group is dropped (EhFrameSection::isFdeLive)
>
> Do you have a realistic case where LLD erroneously errors? If so, can you get a minimal reproduce, use `LLD_REPRODUCE=/tmp/rep.tar` or `-Wl,--reproduce=/tmp/rep.tar` to get a reproduce file and upload it somewhere?


The problem that I faced is with gcc_except_table. I added .eh_frame for completion sake.  The problem was coming while linking in libc++ for a beremetal target. I will try if I can get a minimal testcase from that but it may be difficult. The error looks like this:

ld.lld: error: relocation refers to a symbol in a discarded section:

>>> defined in /opt/llvm/lib/clang-runtimes/riscv64-unknown-elf/rv64imac/lp64/medany/lib/libc++.a(locale.cpp.o)
>>>  section group signature: _ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_
>>>  prevailing definition is in /tmp/test-48f00f.o
>>>  referenced by locale.cpp
>>> 
>>>   locale.cpp.o:(.gcc_except_table+0x6FD) in archive /opt/llvm/lib/clang-runtimes/riscv64-unknown-elf/rv64imac/lp64/medany/lib/libc++.a
>>> 
>>> referenced by locale.cpp
>>> 
>>>   locale.cpp.o:(.gcc_except_table+0x706) in archive /opt/llvm/lib/clang-runtimes/riscv64-unknown-elf/rv64imac/lp64/medany/lib/libc++.a
>>> 
>>> referenced by locale.cpp
>>> 
>>>   locale.cpp.o:(.gcc_except_table+0x70A) in archive /opt/llvm/lib/clang-runtimes/riscv64-unknown-elf/rv64imac/lp64/medany/lib/libc++.a


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83244/new/

https://reviews.llvm.org/D83244





More information about the llvm-commits mailing list