forked from OSchip/llvm-project
[llvm-nm] Display defined weak STT_GNU_IFUNC symbols as 'i'
This patch makes the behavior match GNU nm. Note: undefined STT_GNU_IFUNC symbols use 'U'. Differential Revision: https://reviews.llvm.org/D95461
This commit is contained in:
parent
2dd0c4d846
commit
b3af96d07b
|
@ -5,6 +5,9 @@
|
|||
|
||||
# CHECK: i ifunc_local
|
||||
# CHECK-NEXT: i ifunc_global
|
||||
# CHECK-NEXT: i ifunc_weak
|
||||
# CHECK-NEXT: U ifunc_undef
|
||||
# CHECK-NEXT: w ifunc_undef_weak
|
||||
|
||||
!ELF
|
||||
FileHeader:
|
||||
|
@ -25,3 +28,13 @@ Symbols:
|
|||
Type: STT_GNU_IFUNC
|
||||
Binding: STB_GLOBAL
|
||||
Section: .text
|
||||
- Name: ifunc_weak
|
||||
Type: STT_GNU_IFUNC
|
||||
Binding: STB_WEAK
|
||||
Section: .text
|
||||
- Name: ifunc_undef
|
||||
Type: STT_GNU_IFUNC
|
||||
Binding: STB_GLOBAL
|
||||
- Name: ifunc_undef_weak
|
||||
Type: STT_GNU_IFUNC
|
||||
Binding: STB_WEAK
|
||||
|
|
|
@ -1142,13 +1142,16 @@ static char getNMSectionTagAndName(SymbolicFile &Obj, basic_symbol_iterator I,
|
|||
}
|
||||
}
|
||||
|
||||
if ((Symflags & object::SymbolRef::SF_Weak) && !isa<MachOObjectFile>(Obj)) {
|
||||
char Ret = isObject(Obj, I) ? 'v' : 'w';
|
||||
return (!(Symflags & object::SymbolRef::SF_Undefined)) ? toupper(Ret) : Ret;
|
||||
if (Symflags & object::SymbolRef::SF_Undefined) {
|
||||
if (isa<MachOObjectFile>(Obj) || !(Symflags & object::SymbolRef::SF_Weak))
|
||||
return 'U';
|
||||
return isObject(Obj, I) ? 'v' : 'w';
|
||||
}
|
||||
|
||||
if (Symflags & object::SymbolRef::SF_Undefined)
|
||||
return 'U';
|
||||
if (ELFObjectFileBase *ELF = dyn_cast<ELFObjectFileBase>(&Obj))
|
||||
if (ELFSymbolRef(*I).getELFType() == ELF::STT_GNU_IFUNC)
|
||||
return 'i';
|
||||
if (!isa<MachOObjectFile>(Obj) && (Symflags & object::SymbolRef::SF_Weak))
|
||||
return isObject(Obj, I) ? 'V' : 'W';
|
||||
|
||||
if (Symflags & object::SymbolRef::SF_Common)
|
||||
return 'C';
|
||||
|
@ -1169,8 +1172,6 @@ static char getNMSectionTagAndName(SymbolicFile &Obj, basic_symbol_iterator I,
|
|||
else if (TapiFile *Tapi = dyn_cast<TapiFile>(&Obj))
|
||||
Ret = getSymbolNMTypeChar(*Tapi, 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;
|
||||
|
|
Loading…
Reference in New Issue