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

[llvm-nm] Display STT_GNU_IFUNC as 'i'

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D71803
This commit is contained in:
Fangrui Song 2019-12-21 21:53:22 -08:00
parent d3bcd94780
commit 8e823f1246
3 changed files with 36 additions and 6 deletions

View File

@ -1,7 +1,7 @@
; RUN: opt -module-summary -o %t.bc %s
; RUN: llvm-lto2 run %t.bc -r %t.bc,foo,pl -o %t2
; RUN: llvm-nm %t2.1 | FileCheck %s
; CHECK: T foo
; CHECK: i foo
; CHECK: t foo_ifunc
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -0,0 +1,27 @@
## Test that the symbol type of STT_GNU_IFUNC is 'i'.
# RUN: yaml2obj %s -o %t
# RUN: llvm-nm --no-sort %t | FileCheck %s
# CHECK: i ifunc_local
# CHECK-NEXT: i 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

View File

@ -1133,15 +1133,18 @@ static char getNMSectionTagAndName(SymbolicFile &Obj, basic_symbol_iterator I,
Ret = getSymbolNMTypeChar(*MachO, I);
else if (WasmObjectFile *Wasm = dyn_cast<WasmObjectFile>(&Obj))
Ret = getSymbolNMTypeChar(*Wasm, I);
else
Ret = getSymbolNMTypeChar(cast<ELFObjectFileBase>(Obj), I);
else if (ELFObjectFileBase *ELF = dyn_cast<ELFObjectFileBase>(&Obj)) {
if (ELFSymbolRef(*I).getELFType() == ELF::STT_GNU_IFUNC)
return 'i';
Ret = getSymbolNMTypeChar(*ELF, I);
if (ELFSymbolRef(*I).getBinding() == ELF::STB_GNU_UNIQUE)
return Ret;
} else
llvm_unreachable("unknown binary format");
if (!(Symflags & object::SymbolRef::SF_Global))
return Ret;
if (Obj.isELF() && ELFSymbolRef(*I).getBinding() == ELF::STB_GNU_UNIQUE)
return Ret;
return toupper(Ret);
}