mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[dsymutil] Fix spurious warnings for missing symbols with thinLTO
Fix spurious warnings for missing symbols with thinLTO. The latter appends a unique suffix to avoid collisions for exported private symbols, resulting in dsymutil complaining it couldn't find the symbol in the object file. rdar://75434058 Differential revision: https://reviews.llvm.org/D99125
This commit is contained in:
parent
a2cee22477
commit
e33ed822d1
BIN
test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
Normal file
BIN
test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
Normal file
Binary file not shown.
BIN
test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
Normal file
BIN
test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
Normal file
Binary file not shown.
BIN
test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
Executable file
BIN
test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
24
test/tools/dsymutil/X86/thinlto.test
Normal file
24
test/tools/dsymutil/X86/thinlto.test
Normal file
@ -0,0 +1,24 @@
|
||||
$ cat foo.cpp
|
||||
struct nontrivial {
|
||||
nontrivial() { }
|
||||
};
|
||||
|
||||
void function2()
|
||||
{
|
||||
static const nontrivial magic_static;
|
||||
}
|
||||
|
||||
$ cat bar.cpp
|
||||
void function2();
|
||||
|
||||
void function1()
|
||||
{
|
||||
function2();
|
||||
}
|
||||
|
||||
$ xcrun clang++ -g -flto=thin -O2 foo.cpp bar.cpp -c
|
||||
$ xcrun clang++ -flto=thin foo.o bar.o -Xlinker -object_path_lto -Xlinker lto -shared -o foobar.dylib
|
||||
|
||||
RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/thinlto/foobar.dylib -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
|
||||
CHECK-NOT: could not find object file symbol for symbol __ZZ9function2vE12magic_static
|
||||
CHECK-NOT: could not find object file symbol for symbol __ZGVZ9function2vE12magic_static
|
@ -462,6 +462,17 @@ void MachODebugMapParser::handleStabSymbolTableEntry(uint32_t StringIndex,
|
||||
}
|
||||
}
|
||||
|
||||
// ThinLTO adds a unique suffix to exported private symbols.
|
||||
for (auto Iter = CurrentObjectAddresses.begin();
|
||||
Iter != CurrentObjectAddresses.end(); ++Iter) {
|
||||
llvm::StringRef SymbolName = Iter->getKey();
|
||||
auto Pos = SymbolName.rfind(".llvm.");
|
||||
if (Pos != llvm::StringRef::npos && SymbolName.substr(0, Pos) == Name) {
|
||||
ObjectSymIt = Iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectSymIt == CurrentObjectAddresses.end()) {
|
||||
Warning("could not find object file symbol for symbol " + Twine(Name));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user