https://llvm.org/bugs/show_bug.cgi?id=27228

            Bug ID: 27228
           Summary: lld assertion failure linking FreeBSD base system
                    after r265293
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedb...@nondot.org
          Reporter: ema...@freebsd.org
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

This assertion fails:

(lldb) frame sel 4
frame #4: 0x00000000005b1a74 ld`SymbolBody(this=0x00000008068ea140,
K=SharedKind, Name=StringRef at 0x00007fffffffc798, Binding='\0',
StOther='\0', Type='\0') + 276 at Symbols.h:134
   131        : SymbolKind(K), MustBeInDynSym(false),
NeedsCopyOrPltAddr(false),
   132          Type(Type), Binding(Binding), StOther(StOther),
   133          Name({Name.data(), Name.size()}) {
-> 134      assert(!isLocal());
   135      IsUsedInRegularObj =
   136          K != SharedKind && K != LazyKind && K != DefinedBitcodeKind;
   137    }

The failing symbol is:

(lldb) p Name
(lld::elf::SymbolBody::Str) $1 = (S = "__start_set_kvm_arch", Len = 20)

This is a synthetic symbol generated for section start and stop (for use by
e.g. linker sets), for the "set_kvm_arch" section in a .so that we're linking
against.

It looks like the issue is getSymbolBinding returns only STB_LOCAL for
synthetic symbols:

template <class ELFT>
uint8_t SymbolTableSection<ELFT>::getSymbolBinding(SymbolBody *Body) {
  uint8_t Visibility = Body->getVisibility();
  if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
    return STB_LOCAL;
  if (isa<DefinedSynthetic<ELFT>>(Body))
    return STB_LOCAL;
  return Body->Binding;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to