diff --git a/llvm/test/tools/llvm-objdump/symbol-table-ifunc.test b/llvm/test/tools/llvm-objdump/symbol-table-ifunc.test new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/symbol-table-ifunc.test @@ -0,0 +1,28 @@ +## Test that we print 'i' for STT_GNU_IFUNC. + +# RUN: yaml2obj %s -o %t +# RUN: llvm-objdump -t %t | FileCheck %s + +# CHECK: SYMBOL TABLE: +# CHECK-NEXT: 0000000000000000 l i .text 0000000000000000 ifunc_local +# CHECK-NEXT: 0000000000000000 g i .text 0000000000000000 ifunc_global + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +Symbols: + - Name: ifunc_local + Type: STT_GNU_IFUNC + Binding: STB_LOCAL + Section: .text + - Name: ifunc_global + Type: STT_GNU_IFUNC + Binding: STB_GLOBAL + Section: .text diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1896,6 +1896,10 @@ bool Absolute = Flags & SymbolRef::SF_Absolute; bool Common = Flags & SymbolRef::SF_Common; bool Hidden = Flags & SymbolRef::SF_Hidden; + char Indirect = ' '; + if (auto *ELF = dyn_cast(O)) + if (ELFSymbolRef(*I).getELFType() == ELF::STT_GNU_IFUNC) + Indirect = 'i'; char GlobLoc = ' '; if ((Section != O->section_end() || Absolute) && !Weak) @@ -1918,7 +1922,7 @@ << (Weak ? 'w' : ' ') // Weak? << ' ' // Constructor. Not supported yet. << ' ' // Warning. Not supported yet. - << ' ' // Indirect reference to another symbol. + << Indirect // Indirect reference to another symbol. << Debug // Debugging (d) or dynamic (D) symbol. << FileFunc // Name of function (F), file (f) or object (O). << ' ';