diff --git a/llvm/test/tools/llvm-objdump/ELF/symbol-table.test b/llvm/test/tools/llvm-objdump/ELF/symbol-table.test --- a/llvm/test/tools/llvm-objdump/ELF/symbol-table.test +++ b/llvm/test/tools/llvm-objdump/ELF/symbol-table.test @@ -8,6 +8,7 @@ # CHECK-NEXT:0000000000001fff l F .text 0000000000000000 local_func # CHECK-NEXT:0000000000002000 l O .data 0000000000000000 local_object # CHECK-NEXT:0000000000000000 l *ABS* 0000000000000000 local_abs +# CHECK-NEXT:0000000000000000 l i .text 0000000000000000 local_ifunc # CHECK-NEXT:0000000000000000 g F .text 000000000000000f func # CHECK-NEXT:0000000000000000 g O .data 0000000000000010 object # CHECK-NEXT:0000000000000000 *UND* 0000000000000000 undef @@ -16,7 +17,7 @@ # CHECK-NEXT:0000000000000000 *UND* 0000000000000000 reserve # CHECK-NEXT:0000000000000000 g *ABS* 0000000000000000 abs # CHECK-NEXT:0000000000000000 *COM* 0000000000000000 common -# CHECK-NEXT:0000000000000000 g .text 0000000000000000 ifunc +# CHECK-NEXT:0000000000000000 g i .text 0000000000000000 ifunc # CHECK-NEXT:0000000000000000 g O .data 0000000000000000 gnu_unique --- !ELF @@ -41,6 +42,9 @@ Value: 0x2000 - Name: local_abs Index: SHN_ABS + - Name: local_ifunc + Type: STT_GNU_IFUNC + Section: .text - Name: func Type: STT_FUNC Size: 0xf 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 @@ -1899,6 +1899,11 @@ char GlobLoc = ' '; if ((Section != O->section_end() || Absolute) && !Weak) GlobLoc = Global ? 'g' : 'l'; + char Ifunc = ' '; + if (auto *ELF = dyn_cast(O)) { + if (ELFSymbolRef(*I).getELFType() == ELF::STT_GNU_IFUNC) + Ifunc = 'i'; + } char Debug = (Type == SymbolRef::ST_Debug || Type == SymbolRef::ST_File) ? 'd' : ' '; char FileFunc = ' '; @@ -1917,7 +1922,7 @@ << (Weak ? 'w' : ' ') // Weak? << ' ' // Constructor. Not supported yet. << ' ' // Warning. Not supported yet. - << ' ' // Indirect reference to another symbol. + << Ifunc << Debug // Debugging (d) or dynamic (D) symbol. << FileFunc // Name of function (F), file (f) or object (O). << ' ';