This patch makes the behavior match GNU nm.
Note: undefined STT_GNU_IFUNC symbols use 'U'.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Unit Tests
Event Timeline
Comment Actions
Display Mach-O WeakRef as 'U'
Mach-O is poorly tested. CC @lhames in case he wants to add Mach-O tests:)
$ echo '__attribute__((weak)) void ref(); __attribute__((weak)) void def() { ref(); };' > test.c && clang -c test.c $ nm test.o 0000000000000000 T _def U _ref
llvm/tools/llvm-nm/llvm-nm.cpp | ||
---|---|---|
1150–1154 | I'd reorder. The isa<MachOObjectFile>(Obj) condition looks a bit too burried. if (Symflags & object::SymbolRef::SF_Undefined) { if (isa<MachOObjectFile>(Obj) || !(Symflags & object::SymbolRef::SF_Weak)) return 'U'; return isObject(Obj, I) ? 'v' : 'w'; } | |
1155 | No need to have curly bracers here. | |
1156 | The same comment about reordering applies here. if (!isa<MachOObjectFile>(Obj) && (Symflags & object::SymbolRef::SF_Weak)) |
Comment Actions
Frankly, the llvm-nm code in this area feels like a bit of a mess, but this is at least an improvement. Just one test suggestion. Otherwise, this looks good.
llvm/test/tools/llvm-nm/ifunc.test | ||
---|---|---|
34–36 | Maybe worth a weak undefined case too. |
Maybe worth a weak undefined case too.