Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] - Allow relocation to a weak undefined symbol when -z notext is…
… given. Previously we failed to resolve them when produced executables: "relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC" Patch fixes it so that we resolve them to 0 for executables. And for -shared case we still should produce the relocation. This finishes fixing PR35720. DIfferential revision: https://reviews.llvm.org/D41551 llvm-svn: 321473
- Loading branch information
George Rimar
committed
Dec 27, 2017
1 parent
edf3c82
commit a0ab8d7
Showing
2 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o | ||
# RUN: not ld.lld -z notext -shared %t.o -o %t 2>&1 | FileCheck %s | ||
# CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC | ||
|
||
# RUN: ld.lld -z notext %t.o -o %t | ||
# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=EXE | ||
# EXE: Relocations [ | ||
# EXE-NEXT: ] | ||
|
||
.text | ||
.global foo | ||
.weak foo | ||
|
||
_start: | ||
mov $foo,%eax |