[PATCH] D89444: [dsymutil] Fix handling of aliases to private external symbols
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 14 20:19:18 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf9fb9da36c34: [dsymutil] Fix handling of aliases to private external symbols (authored by JDevlieghere).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89444/new/
https://reviews.llvm.org/D89444
Files:
llvm/test/tools/dsymutil/ARM/private-extern-alias.test
llvm/test/tools/dsymutil/Inputs/private/tmp/private_extern/main.o
llvm/test/tools/dsymutil/Inputs/private/tmp/private_extern/private_extern.o
llvm/test/tools/dsymutil/Inputs/private/tmp/private_extern/private_extern.out
llvm/tools/dsymutil/MachODebugMapParser.cpp
Index: llvm/tools/dsymutil/MachODebugMapParser.cpp
===================================================================
--- llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -562,7 +562,9 @@
continue;
}
Section = *SectionOrErr;
- if (Section == MainBinary.section_end() || Section->isText())
+ if ((Section == MainBinary.section_end() || Section->isText()) &&
+ !(SymType &
+ MachO::N_PEXT)) // Alias to non-external (was a private external)
continue;
uint64_t Addr = cantFail(Sym.getValue());
Expected<StringRef> NameOrErr = Sym.getName();
Index: llvm/test/tools/dsymutil/ARM/private-extern-alias.test
===================================================================
--- /dev/null
+++ llvm/test/tools/dsymutil/ARM/private-extern-alias.test
@@ -0,0 +1,29 @@
+$ cat private_extern.c
+__attribute__((visibility("hidden")))
+int* foo() {
+ int i = 10;
+ volatile int* j = &i;
+ return j;
+}
+
+int* bar() {
+ return foo();
+}
+
+$ cat main.c
+int* bar();
+int main() {
+ return *bar();
+}
+
+$ cat alias_list
+_foo _baz
+
+$ xcrun --sdk iphoneos clang -g private_extern.c -c -o private_extern.o -target arm64-apple-ios14.0
+$ xcrun --sdk iphoneos clang -g main.c -c -o main.o -target arm64-apple-ios14.0
+$ xcrun --sdk iphoneos clang private_extern.o main.o -target arm64-apple-ios14.0 -o private_extern.out -Xlinker -alias_list -Xlinker alias_list
+
+RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/private_extern/private_extern.out -o %t.dSYM --verbose 2>&1 | FileCheck %s
+CHECK-NOT: could not find object file symbol for symbol _baz
+CHECK: { sym: _foo, objAddr: 0x0000000000000000, binAddr: 0x0000000100007F58, size: 0x00000020 }
+CHECK: { sym: _baz, objAddr: 0x0000000000000000, binAddr: 0x0000000100007F58, size: 0x00000000 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89444.298288.patch
Type: text/x-patch
Size: 1860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201015/2a712b8d/attachment.bin>
More information about the llvm-commits
mailing list