diff --git a/llvm/test/tools/dsymutil/ARM/private-extern-alias.test b/llvm/test/tools/dsymutil/ARM/extern-alias.test similarity index 77% rename from llvm/test/tools/dsymutil/ARM/private-extern-alias.test rename to llvm/test/tools/dsymutil/ARM/extern-alias.test index 99301febb15f..42b31c4d98d2 100644 --- a/llvm/test/tools/dsymutil/ARM/private-extern-alias.test +++ b/llvm/test/tools/dsymutil/ARM/extern-alias.test @@ -10,6 +10,18 @@ int* bar() { return foo(); } +$ cat 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() { @@ -24,6 +36,7 @@ $ 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 +RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/extern/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 } diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/extern.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/extern.o new file mode 100644 index 000000000000..d48040b30264 Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/extern.o differ diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/extern.out b/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/extern.out new file mode 100755 index 000000000000..f06553b070d1 Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/extern.out differ diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/main.o b/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/main.o new file mode 100644 index 000000000000..644483735d7b Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/private/tmp/extern/main.o differ diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp index 3323a0514e32..fccf2f5406a9 100644 --- a/llvm/tools/dsymutil/MachODebugMapParser.cpp +++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp @@ -562,9 +562,7 @@ void MachODebugMapParser::loadMainBinarySymbols( continue; } Section = *SectionOrErr; - if ((Section == MainBinary.section_end() || Section->isText()) && - !(SymType & - MachO::N_PEXT)) // Alias to non-external (was a private external) + if ((Section == MainBinary.section_end() || Section->isText()) && !Extern) continue; uint64_t Addr = cantFail(Sym.getValue()); Expected NameOrErr = Sym.getName();