-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow relocations in rw sections to create plt entries.
If a relocation cannot be implemented by the dynamic linker and the section is rw, allow creating a plt entry to use as the function address as if the section was ro. This matches bfd and gold. It also matches our behavior with -z notext. llvm-svn: 321430
- Loading branch information
Showing
5 changed files
with
24 additions
and
10 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,4 @@ | ||
.global foo | ||
.type foo, @function | ||
foo: | ||
retq |
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,14 @@ | ||
# REQUIRES: x86 | ||
# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux | ||
# RUN: llvm-mc %p/Inputs/writable-sec-plt-reloc.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux | ||
# RUN: ld.lld %t2.o -o %t2.so -shared | ||
# RUN: ld.lld %t.o %t2.so -o %t | ||
# RUN: llvm-readelf --symbols -r %t | FileCheck %s | ||
|
||
# CHECK: R_X86_64_JUMP_SLOT {{.*}} foo + 0 | ||
# CHECK: 0000000000201010 0 FUNC GLOBAL DEFAULT UND foo | ||
|
||
.section .bar,"awx" | ||
.global _start | ||
_start: | ||
call foo |
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 |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
.global _start | ||
_start: | ||
.data | ||
.long bar - . | ||
.long zed - . |