Change how symbol sizes are handled in lib/Object.
COFF and MachO only define symbol sizes for common symbols. Reflect that
in the class hierarchy by having a method for common symbols only in the base
and a general one in ELF.
This avoids the need of using a magic value for the size, which had a few
problems
* Most callers didn't check for it.
* The ones that did could not tell the magic value from a file actually having
that value.
llvm-svn: 240529
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 8adbc70..518d6de 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -784,7 +784,7 @@
uint64_t Address;
if (error(Symbol.getAddress(Address)))
break;
- if (Address == UnknownAddressOrSize)
+ if (Address == UnknownAddress)
continue;
Address -= SectionAddr;
if (Address >= SectSize)
@@ -1101,9 +1101,9 @@
bool Hidden = Flags & SymbolRef::SF_Hidden;
if (Common)
- Address = Symbol.getSize();
+ Address = Symbol.getCommonSize();
- if (Address == UnknownAddressOrSize)
+ if (Address == UnknownAddress)
Address = 0;
char GlobLoc = ' ';
if (Type != SymbolRef::ST_Unknown)
@@ -1149,7 +1149,8 @@
outs() << '\t';
if (Common || isa<ELFObjectFileBase>(o)) {
- uint64_t Val = Common ? Symbol.getAlignment() : Symbol.getSize();
+ uint64_t Val = Common ? Symbol.getAlignment()
+ : cast<ELFObjectFileBase>(o)->getSymbolSize(Symbol);
outs() << format("\t %08" PRIx64 " ", Val);
}