1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Compute the correct symbol size in llvm-nm even without --print-size

In llvm-nm, the symbol size was being computed only with --print-size option,
even though it was being printed in other cases, such as with --format=posix.

This patch simply removes the guard, so that the size is computed
independently of the later decision to print it or not.

Fixes PR39997.

Differential Revision: https://reviews.llvm.org/D57599

llvm-svn: 353011
This commit is contained in:
Sunil Srivastava 2019-02-03 22:40:01 +00:00
parent acab453d6b
commit 10930d44a1
3 changed files with 4 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# RUN: llvm-nm -P %p/Inputs/hello.obj.elf-x86_64 | FileCheck %s
CHECK: main T 0 0
CHECK: main T 0 15
CHECK: puts U 0 0

View File

@ -1,5 +1,5 @@
# RUN: echo "-P %p/Inputs/hello.obj.elf-x86_64" > %t-response
# RUN: llvm-nm @%t-response | FileCheck %s
CHECK: main T 0 0
CHECK: main T 0 15
CHECK: puts U 0 0

View File

@ -1190,10 +1190,8 @@ dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
NMSymbol S = {};
S.Size = 0;
S.Address = 0;
if (PrintSize) {
if (isa<ELFObjectFileBase>(&Obj))
S.Size = ELFSymbolRef(Sym).getSize();
}
if (isa<ELFObjectFileBase>(&Obj))
S.Size = ELFSymbolRef(Sym).getSize();
if (PrintAddress && isa<ObjectFile>(Obj)) {
SymbolRef SymRef(Sym);
Expected<uint64_t> AddressOrErr = SymRef.getAddress();