https://sourceware.org/bugzilla/show_bug.cgi?id=18695
Bug ID: 18695
Summary: [x86-64] Missing relocation overflow check
Product: binutils
Version: 2.26 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: hjl.tools at gmail dot com
CC: ian at airs dot com
Target Milestone: ---
Bits<N>::has_overflow(x) in reloc.h isn't suitable for x86-64
relocation overflow check. has_overflow_xxx in power.cc should
be used for relocation overflow check:
[hjl@gnu-6 gold-1]$ cat x.S
.data
#if 1
.space 0x8ff00000
#else
.space 0x70000000
#endif
.hidden foo
.globl foo
foo:
.byte 20
local:
.byte 20
.text
.globl bar
.type bar, @function
bar:
lea foo(%rip), %rax
lea local(%rip), %rax
.size bar, .-bar
[hjl@gnu-6 gold-1]$ make LD=ld.bfd
gcc -c -o x.o x.S
ld.bfd -z max-page-size=0x200000 -shared -o x.so x.o
x.o: In function `bar':
(.text+0x3): relocation truncated to fit: R_X86_64_PC32 against symbol `foo'
defined in .data section in x.o
x.o: In function `bar':
(.text+0xa): relocation truncated to fit: R_X86_64_PC32 against `.data'
Makefile:25: recipe for target 'x.so' failed
make: *** [x.so] Error 1
[hjl@gnu-6 gold-1]$ make
./ld -z max-page-size=0x200000 -shared -o x.so x.o
objdump -dw x.so
x.so: file format elf64-x86-64
Disassembly of section .text:
00000000000001e0 <bar>:
1e0: 48 8d 05 b9 00 10 90 lea -0x6fefff47(%rip),%rax #
ffffffff901002a0 <__bss_start+0xfffffffefffffffe>
1e7: 48 8d 05 b3 00 10 90 lea -0x6fefff4d(%rip),%rax #
ffffffff901002a1 <__bss_start+0xfffffffeffffffff>
[hjl@gnu-6 gold-1]$
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils