Browse Source
X86-64 TLSDESC sequences can be: 4c 8d 0d 00 00 00 00 leaq foo@TLSDESC(%rip), %r9 4c 89 c8 movq %r9, %rax ff 10 call *foo@TLSCALL(%rax) TLSDESC -> LE relaxation can turn them into: 49 c7 c1 fc ff ff ff mov $0xfffffffffffffffc,%r9 4c 89 c8 mov %r9,%rax 66 90 xchg %ax,%ax We need to check and update the REX byte in this case. PR gold/25473 * x86_64.cc (Target_x86_64<size>::Relocate::tls_desc_gd_to_ie): Properly check r8 - r15 in "lea foo@TLSDESC(%rip), %reg". (Target_x86_64<size>::Relocate::tls_desc_gd_to_le): Properly relax r8 - r15 in "lea foo@TLSDESC(%rip), %reg". * testsuite/Makefile.am (check_SCRIPTS): Add x86_64_gd_to_le.sh. (check_DATA): Add x86_64_gd_to_le.stdout. (MOSTLYCLEANFILES): Add x86_64_gd_to_le. (x86_64_gd_to_le.o): New target. (x86_64_gd_to_le): Likewise. (x86_64_gd_to_le.stdout): Likewise. * testsuite/Makefile.in: Regenerated. * testsuite/x86_64_gd_to_le.s: New file. * testsuite/x86_64_gd_to_le.sh: Likewise.binutils-2_35-branch
6 changed files with 103 additions and 3 deletions
@ -0,0 +1,24 @@ |
|||
.text |
|||
.p2align 4 |
|||
.globl _start |
|||
.type _start, @function |
|||
_start: |
|||
.cfi_startproc |
|||
subq $8, %rsp |
|||
.cfi_def_cfa_offset 16 |
|||
leaq foo@TLSDESC(%rip), %r9 |
|||
movq %r9, %rax |
|||
call *foo@TLSCALL(%rax) |
|||
addq %fs:0, %rax |
|||
addq $8, %rsp |
|||
.cfi_def_cfa_offset 8 |
|||
ret |
|||
.cfi_endproc |
|||
.size _start, .-_start |
|||
.section .tdata,"awT",@progbits |
|||
.align 4 |
|||
.type foo, @object |
|||
.size foo, 4 |
|||
foo: |
|||
.long 30 |
|||
.section .note.GNU-stack,"",@progbits |
|||
@ -0,0 +1,26 @@ |
|||
#!/bin/sh |
|||
|
|||
# x86_64_gd_to_ie.sh -- a test for GDesc -> IE conversion. |
|||
|
|||
# Copyright (C) 2020 Free Software Foundation, Inc. |
|||
|
|||
# This file is part of gold. |
|||
|
|||
# This program is free software; you can redistribute it and/or modify |
|||
# it under the terms of the GNU General Public License as published by |
|||
# the Free Software Foundation; either version 3 of the License, or |
|||
# (at your option) any later version. |
|||
|
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
|
|||
# You should have received a copy of the GNU General Public License |
|||
# along with this program; if not, write to the Free Software |
|||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
|||
# MA 02110-1301, USA. |
|||
|
|||
set -e |
|||
|
|||
grep -q "mov[ \t]\+\$0x[a-f0-9]\+,%r9" x86_64_gd_to_le.stdout |
|||
Loading…
Reference in new issue