[PATCH] D33621: Fix for -wrap linker option and LTO, PR 33145
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 17:09:40 PDT 2017
Dmitry Mikulin via Phabricator <reviews at reviews.llvm.org> writes:
> Index: lld/test/ELF/lto/wrap-2.ll
> ===================================================================
> --- /dev/null
> +++ lld/test/ELF/lto/wrap-2.ll
> @@ -0,0 +1,25 @@
> +; REQUIRES: x86
> +; RUN: llvm-as %s -o %t.o
> +; RUN: llvm-as %S/Inputs/wrap-bar.ll -o %t1.o
> +; RUN: ld.lld %t.o %t1.o -shared -o %t.so -wrap=bar
> +; RUN: llvm-objdump -d %t.so | FileCheck %s
> +
> +; Make sure that calls in foo() are not eliminated and that bar is
> +; routed to __wrap_bar and __real_bar is routed to bar.
> +
> +; CHECK: foo:
> +; CHECK-NEXT: pushq %rax
> +; CHECK-NEXT: callq{{.*}}<__wrap_bar>
> +; CHECK-NEXT: callq{{.*}}<bar>
Please also check the bindings of the *bar symbols.
> Index: lld/ELF/Config.h
> ===================================================================
> --- lld/ELF/Config.h
> +++ lld/ELF/Config.h
> @@ -98,6 +98,10 @@
> std::vector<SymbolVersion> VersionScriptGlobals;
> std::vector<SymbolVersion> VersionScriptLocals;
> std::vector<uint8_t> BuildIdVector;
> +
> + // Mapping of renamed symbols to their original pre-LTO bindings.
> + llvm::StringMap<uint8_t> RenamedSymbols;
Do you really need to map from the symbol name? Why can't you use the
Symbol*?
Cheers,
Rafael
More information about the llvm-commits
mailing list