[elf2] Relocate against undefined weak symbols.

llvm-svn: 248056
This commit is contained in:
Michael J. Spencer 2015-09-18 22:26:13 +00:00
parent 9077e9f8f2
commit 9779535c5d
2 changed files with 15 additions and 1 deletions

View File

@ -750,7 +750,9 @@ void OutputSection<ELFT>::relocate(
Type = R_X86_64_PC32;
break;
case SymbolBody::UndefinedKind:
continue;
assert(Body->isWeak() && "Undefined symbol reached writer");
SymVA = 0;
break;
case SymbolBody::LazyKind:
llvm_unreachable("Lazy symbol reached writer");
}

View File

@ -0,0 +1,12 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
// RUN: lld -flavor gnu2 %t -o %tout
// RUN: llvm-objdump -d %tout | FileCheck %s
// REQUIRES: x86
.global _start
_start:
movl $1, sym1(%rip)
.weak sym1
// CHECK: movl $1, -69642(%rip)