[llvm] r281366 - [LTO] Don't pass SF_Undefined symbols to the IRmover.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 14:48:11 PDT 2016


After seening Teresa's comment on the bug I this she is right. Gold is
getting the wrong resolution because we are giving it wrong info.

The underlying bug is:

https://llvm.org/bugs/show_bug.cgi?id=30390

and I think this patch just avoids it in this case.

Cheers,
Rafael



On 13 September 2016 at 14:45, Davide Italiano via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: davide
> Date: Tue Sep 13 13:45:13 2016
> New Revision: 281366
>
> URL: http://llvm.org/viewvc/llvm-project?rev=281366&view=rev
> Log:
> [LTO] Don't pass SF_Undefined symbols to the IRmover.
>
> This should fix PR 30363.
>
> Added:
>     llvm/trunk/test/tools/gold/X86/asm_undefined.ll
> Modified:
>     llvm/trunk/lib/LTO/LTO.cpp
>
> Modified: llvm/trunk/lib/LTO/LTO.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTO.cpp?rev=281366&r1=281365&r2=281366&view=diff
> ==============================================================================
> --- llvm/trunk/lib/LTO/LTO.cpp (original)
> +++ llvm/trunk/lib/LTO/LTO.cpp Tue Sep 13 13:45:13 2016
> @@ -337,6 +337,8 @@ Error LTO::addRegularLTO(std::unique_ptr
>      addSymbolToGlobalRes(Obj.get(), Used, Sym, Res, 0);
>
>      GlobalValue *GV = Obj->getSymbolGV(Sym.I->getRawDataRefImpl());
> +    if (Sym.getFlags() & object::BasicSymbolRef::SF_Undefined)
> +      continue;
>      if (Res.Prevailing && GV) {
>        Keep.push_back(GV);
>        switch (GV->getLinkage()) {
>
> Added: llvm/trunk/test/tools/gold/X86/asm_undefined.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/asm_undefined.ll?rev=281366&view=auto
> ==============================================================================
> --- llvm/trunk/test/tools/gold/X86/asm_undefined.ll (added)
> +++ llvm/trunk/test/tools/gold/X86/asm_undefined.ll Tue Sep 13 13:45:13 2016
> @@ -0,0 +1,18 @@
> +; RUN: llvm-as %s -o %t.o
> +; RUN: %gold -shared -m elf_x86_64 -o %t2 -plugin %llvmshlibdir/LLVMgold.so \
> +; RUN: %t.o --plugin-opt=save-temps
> +; RUN: llvm-nm %t2 | FileCheck %s --check-prefix=OUTPUT
> +
> +; OUTPUT: w patatino
> +
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-unknown-linux-gnu"
> +
> +module asm ".weak patatino"
> +
> +declare void @patatino()
> +
> +define void @_start() {
> +  call void @patatino()
> +  ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list