[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code |
Date: |
Sat, 05 Dec 2020 02:19:45 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27016
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
CC| |hjl.tools at gmail dot com
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
I can't reproduce it with binutils master branch:
[hjl@gnu-cfl-2 pr27016]$ cat pr27016a.s
.text
.comm global_int,4,4
.globl main
.type main, @function
main:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movq thesym@GOTPCREL(%rip), %r11
movl (%r11), %eax
leal 1(%rax), %edx
movq thesym@GOTPCREL(%rip), %r11
movl %edx, (%r11)
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.size main, .-main
.section .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 pr27016]$ cat pr27016b.s
.globl thesym
thesym = 0x40402c
.section .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 pr27016]$ make
as -mrelax-relocations=no -o pr27016a.o pr27016a.s
as -mrelax-relocations=no -o pr27016b.o pr27016b.s
/usr/gcc-9.3.1-x32/bin/gcc -B./ -o x pr27016a.o pr27016b.o -Wl,-R,.
objdump -dwr pr27016a.o
pr27016a.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <main>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 4c 8b 1d 00 00 00 00 mov 0x0(%rip),%r11 # b <main+0xb>
7: R_X86_64_GOTPCREL thesym-0x4
b: 41 8b 03 mov (%r11),%eax
e: 8d 50 01 lea 0x1(%rax),%edx
11: 4c 8b 1d 00 00 00 00 mov 0x0(%rip),%r11 # 18 <main+0x18>
14: R_X86_64_GOTPCREL thesym-0x4
18: 41 89 13 mov %edx,(%r11)
1b: b8 00 00 00 00 mov $0x0,%eax
20: 5d pop %rbp
21: c3 ret
objdump --disassemble=main x
x: file format elf64-x86-64
Disassembly of section .init:
Disassembly of section .text:
0000000000400596 <main>:
400596: 55 push %rbp
400597: 48 89 e5 mov %rsp,%rbp
40059a: 4c 8d 1d 8b 3a 00 00 lea 0x3a8b(%rip),%r11 #
40402c <thesym>
4005a1: 41 8b 03 mov (%r11),%eax
4005a4: 8d 50 01 lea 0x1(%rax),%edx
4005a7: 4c 8d 1d 7e 3a 00 00 lea 0x3a7e(%rip),%r11 #
40402c <thesym>
4005ae: 41 89 13 mov %edx,(%r11)
4005b1: b8 00 00 00 00 mov $0x0,%eax
4005b6: 5d pop %rbp
4005b7: c3 ret
Disassembly of section .fini:
[hjl@gnu-cfl-2 pr27016]$
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/27016] New: x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code, matz at suse dot de, 2020/12/04
- [Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code, matz at suse dot de, 2020/12/04
- [Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code,
hjl.tools at gmail dot com <=
- [Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code, hjl.tools at gmail dot com, 2020/12/04
- [Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code, cvs-commit at gcc dot gnu.org, 2020/12/04
- [Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code, cvs-commit at gcc dot gnu.org, 2020/12/04
- [Bug ld/27016] x86-64: GOTPCREL relaxation with abs symbol and REX byte creates incorrect code, hjl.tools at gmail dot com, 2020/12/04