forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lld/ELF] Hint if R_X86_64_PC32 overflows and references a SHF_X86_64…
…_LARGE section (llvm#73045) Makes it clearer what the issue is when hand-written assembly doesn't follow medium code model assumptions in a medium code model build. Alternative to llvm#71248 by only hinting on an overflow.
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 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,25 @@ | ||
# REQUIRES: x86 | ||
# RUN: split-file %s %t | ||
# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o | ||
# RUN: not ld.lld %t/a.o -T %t/lds -o /dev/null 2>&1 | FileCheck %s | ||
|
||
# CHECK: error: {{.*}}a.o:(.text+{{.*}}): relocation R_X86_64_PC32 out of range: {{.*}}; R_X86_64_PC32 should not reference a section marked SHF_X86_64_LARGE | ||
|
||
#--- a.s | ||
.text | ||
.globl _start | ||
.type _start, @function | ||
_start: | ||
movq hello(%rip), %rax | ||
|
||
.section ldata,"awl",@progbits | ||
.type hello, @object | ||
.globl hello | ||
hello: | ||
.long 1 | ||
|
||
#--- lds | ||
SECTIONS { | ||
.text 0x100000 : { *(.text) } | ||
ldata 0x80200000 : { *(ldata) } | ||
} |