From: Davide Italiano Date: Tue, 13 Sep 2016 18:45:13 +0000 (+0000) Subject: [LTO] Don't pass SF_Undefined symbols to the IRmover. X-Git-Tag: llvmorg-4.0.0-rc1~9915 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=39ccd24126fcb99e95f15e49278a88adece2319a;p=platform%2Fupstream%2Fllvm.git [LTO] Don't pass SF_Undefined symbols to the IRmover. This should fix PR 30363. llvm-svn: 281366 --- diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index f495774..0323bb8 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -337,6 +337,8 @@ Error LTO::addRegularLTO(std::unique_ptr Input, 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()) { diff --git a/llvm/test/tools/gold/X86/asm_undefined.ll b/llvm/test/tools/gold/X86/asm_undefined.ll new file mode 100644 index 0000000..6e889a0 --- /dev/null +++ b/llvm/test/tools/gold/X86/asm_undefined.ll @@ -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 +}