[llvm] 3d6c7d6 - [dsymutil] Fix spurious warnings for missing symbols with thinLTO
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 30 14:31:20 PDT 2021
Any chance of using assembly for these test object files to make them more
legible/maintainable?
On Mon, Mar 22, 2021 at 6:37 PM Jonas Devlieghere via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
>
> Author: Jonas Devlieghere
> Date: 2021-03-22T18:36:39-07:00
> New Revision: 3d6c7d6e8e449913aed81544e6c6900fa6ea40cd
>
> URL:
> https://github.com/llvm/llvm-project/commit/3d6c7d6e8e449913aed81544e6c6900fa6ea40cd
> DIFF:
> https://github.com/llvm/llvm-project/commit/3d6c7d6e8e449913aed81544e6c6900fa6ea40cd.diff
>
> LOG: [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
>
> Added:
> llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
> llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
> llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
>
> llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.o
>
> llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.o
> llvm/test/tools/dsymutil/X86/thinlto.test
>
> Modified:
> llvm/tools/dsymutil/MachODebugMapParser.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
> new file mode 100644
> index 000000000000..26d795f44e1a
> Binary files /dev/null and
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/bar.o
> diff er
>
> diff --git a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
> new file mode 100644
> index 000000000000..b7dcab5c27ba
> Binary files /dev/null and
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foo.o
> diff er
>
> diff --git
> a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
> new file mode 100755
> index 000000000000..75b22f377237
> Binary files /dev/null and
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/foobar.dylib
> diff er
>
> diff --git
> a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.o
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.o
> new file mode 100644
> index 000000000000..119b9268e539
> Binary files /dev/null and
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/0.x86_64.thinlto.o
>
> diff er
>
> diff --git
> a/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.o
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.o
> new file mode 100644
> index 000000000000..1c207a7e8515
> Binary files /dev/null and
> b/llvm/test/tools/dsymutil/Inputs/private/tmp/thinlto/lto/1.x86_64.thinlto.o
>
> diff er
>
> diff --git a/llvm/test/tools/dsymutil/X86/thinlto.test
> b/llvm/test/tools/dsymutil/X86/thinlto.test
> new file mode 100644
> index 000000000000..ebd4068a5c12
> --- /dev/null
> +++ b/llvm/test/tools/dsymutil/X86/thinlto.test
> @@ -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
>
> diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp
> b/llvm/tools/dsymutil/MachODebugMapParser.cpp
> index fccf2f5406a9..7d45b2f5e623 100644
> --- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
> +++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
> @@ -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;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210330/9e55ad38/attachment.html>
More information about the llvm-commits
mailing list