public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED][AArch64] Fix off by one error in instruction relaxation mask.
@ 2014-04-15 16:52 Marcus Shawcroft
  0 siblings, 0 replies; only message in thread
From: Marcus Shawcroft @ 2014-04-15 16:52 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

Hi,

The AArch64 TLSDESC to IE relaxation code uses a bit mask intended to
ensure that destination register in a relaxed ldr instruction is
always X0.  The mask has an off by one error resulting in the most
significant bit of the destination register being retained in the
relaxed instruction.  The issue generally appears when the compiler
emits TLS accesses code under high register pressure resulting in a
broken code sequence.

Tested on aarch64-none-linux-gnu.  Committed.

I'll back port to 2.24 shortly.

/Marcus

ld 
 

 
 

2014-04-15  Marcus Shawcroft  <marcus.shawcroft@arm.com>

         * (elfNN_aarch64_tls_relax): Fix instruction mask.
 
 

ld/testsuite 
 


2014-04-15  Marcus Shawcroft  <marcus.shawcroft@arm.com>

         * ld-aarch64/tls-relax-gdesc-ie.s (var): Adjust test case
         to include all 5 bits of LDR destination register.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-AArch64-Fix-off-by-one-error-in-instruction-relaxati.patch --]
[-- Type: text/x-patch;  name=0001-AArch64-Fix-off-by-one-error-in-instruction-relaxati.patch, Size: 951 bytes --]

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 638938d..a251698 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -3957,7 +3957,7 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals,
 	     ldr xd, [x0, #:tlsdesc_lo12:var] => ldr x0, [x0, #:gottprel_lo12:var]
 	   */
 	  insn = bfd_getl32 (contents + rel->r_offset);
-	  insn &= 0xfffffff0;
+	  insn &= 0xffffffe0;
 	  bfd_putl32 (insn, contents + rel->r_offset);
 	  return bfd_reloc_continue;
 	}
diff --git a/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s b/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s
index c20690c..38b3721 100644
--- a/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s
+++ b/ld/testsuite/ld-aarch64/tls-relax-gdesc-ie.s
@@ -4,7 +4,7 @@ var:
 	.word	2
 	.text
 	adrp	x0, :tlsdesc:var
-	ldr	x1, [x0, #:tlsdesc_lo12:var]
+	ldr	x17, [x0, #:tlsdesc_lo12:var]
 	add	x0, x0, :tlsdesc_lo12:var
 	.tlsdesccall	var
 	blr	x1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-15 16:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 16:52 [COMMITTED][AArch64] Fix off by one error in instruction relaxation mask Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).