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

This should fix PR 30363.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Davide Italiano 2016-09-13 18:45:13 +00:00
parent f5f2db2791
commit 9330005ad6
2 changed files with 20 additions and 0 deletions

View File

@ -337,6 +337,8 @@ Error LTO::addRegularLTO(std::unique_ptr<InputFile> 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()) {

View File

@ -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
}