summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/InputFiles.cpp17
-rw-r--r--lld/ELF/SymbolTable.cpp5
-rw-r--r--lld/ELF/Symbols.cpp13
-rw-r--r--lld/ELF/Symbols.h6
-rw-r--r--lld/test/ELF/resolution.s2
5 files changed, 16 insertions, 27 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index aa39bb67502..31c9122b99c 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -316,8 +316,7 @@ SymbolBody *elf::ObjectFile<ELFT>::createSymbolBody(const Elf_Sym *Sym) {
InputSectionBase<ELFT> *Sec = getSection(*Sym);
if (Binding == STB_LOCAL) {
if (Sym->st_shndx == SHN_UNDEF)
- return new (Alloc)
- Undefined(Sym->st_name, Sym->st_other, Sym->getType(), Sym->st_size);
+ return new (Alloc) Undefined(Sym->st_name, Sym->st_other, Sym->getType());
return new (Alloc) DefinedRegular<ELFT>(*Sym, Sec);
}
@@ -325,9 +324,8 @@ SymbolBody *elf::ObjectFile<ELFT>::createSymbolBody(const Elf_Sym *Sym) {
switch (Sym->st_shndx) {
case SHN_UNDEF:
- return new (Alloc)
- Undefined(Name, Binding, Sym->st_other, Sym->getType(), Sym->st_size,
- /*IsBitcode*/ false);
+ return new (Alloc) Undefined(Name, Binding, Sym->st_other, Sym->getType(),
+ /*IsBitcode*/ false);
case SHN_COMMON:
return new (Alloc) DefinedCommon(Name, Sym->st_size, Sym->st_value, Binding,
Sym->st_other, Sym->getType());
@@ -340,9 +338,8 @@ SymbolBody *elf::ObjectFile<ELFT>::createSymbolBody(const Elf_Sym *Sym) {
case STB_WEAK:
case STB_GNU_UNIQUE:
if (Sec == &InputSection<ELFT>::Discarded)
- return new (Alloc)
- Undefined(Name, Binding, Sym->st_other, Sym->getType(), Sym->st_size,
- /*IsBitcode*/ false);
+ return new (Alloc) Undefined(Name, Binding, Sym->st_other, Sym->getType(),
+ /*IsBitcode*/ false);
return new (Alloc) DefinedRegular<ELFT>(Name, *Sym, Sec);
}
}
@@ -548,14 +545,14 @@ BitcodeFile::createBody(const DenseSet<const Comdat *> &KeptComdats,
if (const Comdat *C = GV->getComdat())
if (!KeptComdats.count(C)) {
Body = new (Alloc) Undefined(NameRef, Binding, Visibility, /*Type*/ 0,
- /*Size*/ 0, /*IsBitcode*/ true);
+ /*IsBitcode*/ true);
return Body;
}
const Module &M = Obj.getModule();
if (Flags & BasicSymbolRef::SF_Undefined)
return new (Alloc) Undefined(NameRef, Binding, Visibility, /*Type*/ 0,
- /*Size*/ 0, /*IsBitcode*/ true);
+ /*IsBitcode*/ true);
if (Flags & BasicSymbolRef::SF_Common) {
// FIXME: Set SF_Common flag correctly for module asm symbols, and expose
// size and alignment.
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index bfd70bca5ae..f71c82b8af6 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -150,9 +150,8 @@ template <class ELFT> void SymbolTable<ELFT>::addCombinedLtoObject() {
// Add an undefined symbol.
template <class ELFT>
SymbolBody *SymbolTable<ELFT>::addUndefined(StringRef Name) {
- auto *Sym = new (Alloc)
- Undefined(Name, STB_GLOBAL, STV_DEFAULT, /*Type*/ 0, /*Size*/ 0,
- /*IsBitcode*/ false);
+ auto *Sym = new (Alloc) Undefined(Name, STB_GLOBAL, STV_DEFAULT, /*Type*/ 0,
+ /*IsBitcode*/ false);
resolve(Sym);
return Sym;
}
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index e911f18df96..f73a9c71da0 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -174,8 +174,6 @@ template <class ELFT> typename ELFT::uint SymbolBody::getSize() const {
return DR->Size;
if (const auto *S = dyn_cast<SharedSymbol<ELFT>>(this))
return S->Sym.st_size;
- if (const auto *U = dyn_cast<Undefined>(this))
- return U->Size;
return 0;
}
@@ -232,16 +230,13 @@ bool DefinedBitcode::classof(const SymbolBody *S) {
}
Undefined::Undefined(StringRef Name, uint8_t Binding, uint8_t StOther,
- uint8_t Type, uint64_t Size, bool IsBitcode)
- : SymbolBody(SymbolBody::UndefinedKind, Name, Binding, StOther, Type),
- Size(Size) {
+ uint8_t Type, bool IsBitcode)
+ : SymbolBody(SymbolBody::UndefinedKind, Name, Binding, StOther, Type) {
this->IsUndefinedBitcode = IsBitcode;
}
-Undefined::Undefined(uint32_t NameOffset, uint8_t StOther, uint8_t Type,
- uint64_t Size)
- : SymbolBody(SymbolBody::UndefinedKind, NameOffset, StOther, Type),
- Size(Size) {
+Undefined::Undefined(uint32_t NameOffset, uint8_t StOther, uint8_t Type)
+ : SymbolBody(SymbolBody::UndefinedKind, NameOffset, StOther, Type) {
this->IsUndefinedBitcode = false;
}
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index dd06565a373..f6fd0aa511e 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -312,10 +312,8 @@ public:
class Undefined : public SymbolBody {
public:
Undefined(StringRef Name, uint8_t Binding, uint8_t StOther, uint8_t Type,
- uint64_t Size, bool IsBitcode);
- Undefined(uint32_t NameOffset, uint8_t StOther, uint8_t Type, uint64_t Size);
-
- uint64_t Size;
+ bool IsBitcode);
+ Undefined(uint32_t NameOffset, uint8_t StOther, uint8_t Type);
static bool classof(const SymbolBody *S) {
return S->kind() == UndefinedKind;
diff --git a/lld/test/ELF/resolution.s b/lld/test/ELF/resolution.s
index ce275c2934a..5596212b3ba 100644
--- a/lld/test/ELF/resolution.s
+++ b/lld/test/ELF/resolution.s
@@ -309,7 +309,7 @@
// CHECK-NEXT: Symbol {
// CHECK-NEXT: Name: UndefWeak_with_UndefWeak
// CHECK-NEXT: Value: 0x0
-// CHECK-NEXT: Size: 15
+// CHECK-NEXT: Size: 0
// CHECK-NEXT: Binding: Weak
// CHECK-NEXT: Type: None
// CHECK-NEXT: Other: 0
OpenPOWER on IntegriCloud