[lld] r265293 - Don't store an Elf_Sym for most symbols.

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 5 11:37:54 PDT 2016


On 4 April 2016 at 10:04, Rafael Espindola via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Mon Apr  4 09:04:16 2016
> New Revision: 265293
>
> URL: http://llvm.org/viewvc/llvm-project?rev=265293&view=rev
> Log:
> Don't store an Elf_Sym for most symbols.
>
> [...]
> @@ -70,14 +70,21 @@ public:
>    bool isCommon() const { return SymbolKind == DefinedCommonKind; }
>    bool isLazy() const { return SymbolKind == LazyKind; }
>    bool isShared() const { return SymbolKind == SharedKind; }
> -  bool isLocal() const { return IsLocal; }
> +  bool isLocal() const { return Binding == llvm::ELF::STB_LOCAL; }
>    bool isUsedInRegularObj() const { return IsUsedInRegularObj; }
>    bool isPreemptible() const;
>
>    // Returns the symbol name.
> -  StringRef getName() const { return Name; }
> +  StringRef getName() const {
> +    assert(!isLocal());
> +    return Name;
> +  }

A quick heads-up that the FreeBSD base system lld-as-ld build trips
over this new assert.

(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    }
(lldb) p Name
(lld::elf::SymbolBody::Str) $1 = (S = "__start_set_kvm_arch", Len = 20)

__start_set_kvm_arch is a generated linker set symbol for the
set_kvm_arch section from libkvm.so:

  [22] set_kvm_arch      PROGBITS         0000000000010300  00010300
       0000000000000058  0000000000000000  WA       0     0     8


More information about the llvm-commits mailing list