Remove Size from Undefined symbol.

There seems to be no reason to keep st_size of undefined symbols.
This patch removes the member for it. This patch will change outputs
in cases that undefined symbols are copied to output, but I think
this is unimportant.

Differential Revision: http://reviews.llvm.org/D19574

llvm-svn: 267826
This commit is contained in:
Rui Ueyama
2016-04-28 00:26:54 +00:00
parent f10237b689
commit 62ee16faa8
5 changed files with 16 additions and 27 deletions

View File

@@ -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.