[PATCH] D95461: [llvm-nm] Display defined weak STT_GNU_IFUNC symbols as 'i'
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 28 09:46:15 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb3af96d07b8b: [llvm-nm] Display defined weak STT_GNU_IFUNC symbols as 'i' (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95461/new/
https://reviews.llvm.org/D95461
Files:
llvm/test/tools/llvm-nm/ifunc.test
llvm/tools/llvm-nm/llvm-nm.cpp
Index: llvm/tools/llvm-nm/llvm-nm.cpp
===================================================================
--- llvm/tools/llvm-nm/llvm-nm.cpp
+++ llvm/tools/llvm-nm/llvm-nm.cpp
@@ -1142,13 +1142,16 @@
}
}
- 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 @@
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;
Index: llvm/test/tools/llvm-nm/ifunc.test
===================================================================
--- llvm/test/tools/llvm-nm/ifunc.test
+++ llvm/test/tools/llvm-nm/ifunc.test
@@ -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 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95461.319904.patch
Type: text/x-patch
Size: 2149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210128/e63af88e/attachment.bin>
More information about the llvm-commits
mailing list