Index: test/tools/llvm-nm/format-sysv-binding.test =================================================================== --- test/tools/llvm-nm/format-sysv-binding.test +++ test/tools/llvm-nm/format-sysv-binding.test @@ -1,8 +1,3 @@ -# 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: llvm-nm %t.o --format=sysv | FileCheck %s @@ -27,7 +22,7 @@ Section: .text Value: 0x102 Size: 4 - - Name: symbol_undefined_binding + - Name: symbol_unrecognised_binding Binding: 5 Section: .text Value: 0x1004 @@ -40,5 +35,5 @@ # CHECK: symbol_global {{.*}}| T | # CHECK-NEXT: symbol_local {{.*}}| t | -# CHECK-NEXT: symbol_unrecognised_binding {{.*}}| ? | +# CHECK-NEXT: symbol_unrecognised_binding{{.*}}| ? | # CHECK-NEXT: symbol_weak {{.*}}| W | Index: tools/llvm-nm/llvm-nm.cpp =================================================================== --- tools/llvm-nm/llvm-nm.cpp +++ tools/llvm-nm/llvm-nm.cpp @@ -894,9 +894,13 @@ return '?'; } - if (SymI->getBinding() == ELF::STB_GNU_UNIQUE) + uint8_t Binding = SymI->getBinding(); + if (Binding == ELF::STB_GNU_UNIQUE) return 'u'; + 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();