1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[llvm-nm] Fix for BZ41711 - Class character for a symbol with undefined

binding does not match class assigned by GNU nm

 Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=41711

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

llvm-svn: 364559
This commit is contained in:
Chris Jackson 2019-06-27 16:27:53 +00:00
parent 80aff4d691
commit c94cc22866
2 changed files with 32 additions and 27 deletions

View File

@ -1,9 +1,4 @@
# XFAIL: *
# For a symbol in a text section the class character for an unrecognised binding
# value is '?' in gnu-nm but llvm-nm prints 'T'. Filed as:
# https://bugs.llvm.org/show_bug.cgi?id=41711
# RUN: yaml2obj %s > %t.o
# RUN: yaml2obj %s -o %t.o
# RUN: llvm-nm %t.o --format=sysv | FileCheck %s
!ELF
@ -17,28 +12,33 @@ Sections:
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Symbols:
- Name: symbol_local
- Name: local_binding
Binding: STB_LOCAL
Section: .text
Value: 0x101
Size: 8
- Name: symbol_weak
Binding: STB_WEAK
Section: .text
Value: 0x102
Size: 4
- Name: symbol_undefined_binding
Binding: 5
Section: .text
Value: 0x1004
Size: 32
- Name: symbol_global
Value: 0xbeef
- Name: global_binding
Binding: STB_GLOBAL
Section: .text
Value: 0x103
Size: 16
- Name: weak_binding
Binding: STB_WEAK
Section: .text
- Name: unrecognised_binding
Binding: 5
Section: .text
- Name: gnu_unique_binding
Binding: 10
Section: .text
- Name: os_binding
Binding: 11
Section: .text
- Name: proc_binding
Binding: 14
Section: .text
# CHECK: symbol_global {{.*}}| T |
# CHECK-NEXT: symbol_local {{.*}}| t |
# CHECK-NEXT: symbol_unrecognised_binding {{.*}}| ? |
# CHECK-NEXT: symbol_weak {{.*}}| W |
# CHECK: global_binding {{.*}}| T |
# CHECK-NEXT: gnu_unique_binding {{.*}}| u |
# CHECK-NEXT: local_binding {{.*}}| t |
# CHECK-NEXT: os_binding {{.*}}| ? |
# CHECK-NEXT: proc_binding {{.*}}| ? |
# CHECK-NEXT: unrecognised_binding{{.*}}| ? |
# CHECK-NEXT: weak_binding {{.*}}| W |

View File

@ -894,9 +894,14 @@ static char getSymbolNMTypeChar(ELFObjectFileBase &Obj,
return '?';
}
if (SymI->getBinding() == ELF::STB_GNU_UNIQUE)
uint8_t Binding = SymI->getBinding();
if (Binding == ELF::STB_GNU_UNIQUE)
return 'u';
assert(Binding != ELF::STB_WEAK && "STB_WEAK not tested in calling function");
if (Binding != ELF::STB_GLOBAL && Binding != ELF::STB_LOCAL)
return '?';
elf_section_iterator SecI = *SecIOrErr;
if (SecI != Obj.section_end()) {
uint32_t Type = SecI->getType();