public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch, AArch64] Enable overflow check for TLSLE_MOVW_TPREL_G2
@ 2015-01-12 15:00 Jiong Wang
  2015-01-13 10:34 ` Marcus Shawcroft
  0 siblings, 1 reply; 2+ messages in thread
From: Jiong Wang @ 2015-01-12 15:00 UTC (permalink / raw)
  To: binutils

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

currently, this relocation is not generated by gcc, but maybe future or by hand assembly.

the relocation value is calculated correctly, overflow info kept while the overflow check is
not enabled.

pass native ld test.

ok for trunk?
thanks.

bfd/
   * elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check for
   TLSLE_MOVW_TPREL_G2.

ld/testsuite/
   * ld-aarch64/tprel_g2_overflow.s: New testcase.
   * ld-aarch64/tprel_g2_overflow.d: New expectation file.
   * ld-aarch64/aarch64-elf.exp: Run new testcase.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: overflow-check-tprel-g2.patch --]
[-- Type: text/x-patch; name=overflow-check-tprel-g2.patch, Size: 2017 bytes --]

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 404273d..a710105 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -968,7 +968,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
 	 12,			/* bitsize */
 	 FALSE,			/* pc_relative */
 	 0,			/* bitpos */
-	 complain_overflow_dont,	/* complain_on_overflow */
+	 complain_overflow_unsigned,	/* complain_on_overflow */
 	 bfd_elf_generic_reloc,	/* special_function */
 	 AARCH64_R_STR (TLSLE_MOVW_TPREL_G2),	/* name */
 	 FALSE,			/* partial_inplace */
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 09c2cd0..170c6fa 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -131,6 +131,7 @@ run_dump_test "gc-plt-relocs"
 run_dump_test "gc-relocs-257-dyn"
 run_dump_test "gc-relocs-257"
 run_dump_test "pr17415"
+run_dump_test "tprel_g2_overflow"
 
 # ifunc tests
 run_dump_test "ifunc-1"
diff --git a/ld/testsuite/ld-aarch64/tprel_g2_overflow.d b/ld/testsuite/ld-aarch64/tprel_g2_overflow.d
new file mode 100644
index 0000000..8dcbe87
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/tprel_g2_overflow.d
@@ -0,0 +1,6 @@
+#name: TLS offset out of range - TPREL_G2
+#source: tprel_g2_overflow.s
+#as:
+#ld: -e0
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLE_MOVW_TPREL_G2 against symbol `i' .*
+
diff --git a/ld/testsuite/ld-aarch64/tprel_g2_overflow.s b/ld/testsuite/ld-aarch64/tprel_g2_overflow.s
new file mode 100644
index 0000000..d94a30d
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/tprel_g2_overflow.s
@@ -0,0 +1,22 @@
+	.cpu generic
+	.global	ff
+	.section	.tbss,"awT",%nobits
+	.align	3
+	.type	ff, %object
+	.size	ff, 562949953421312
+ff:
+	.zero	562949953421312
+	.global	i
+	.align	2
+	.type	i, %object
+	.size	i, 4
+i:
+	.zero	4
+	.text
+	.align	2
+	.global	main
+	.type	main, %function
+main:
+	movz	x0, #:tprel_g2:i
+	ret
+	.size	main, .-main

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch, AArch64] Enable overflow check for TLSLE_MOVW_TPREL_G2
  2015-01-12 15:00 [Patch, AArch64] Enable overflow check for TLSLE_MOVW_TPREL_G2 Jiong Wang
@ 2015-01-13 10:34 ` Marcus Shawcroft
  0 siblings, 0 replies; 2+ messages in thread
From: Marcus Shawcroft @ 2015-01-13 10:34 UTC (permalink / raw)
  To: Jiong Wang; +Cc: binutils

On 12 January 2015 at 15:00, Jiong Wang <jiong.wang@arm.com> wrote:
> currently, this relocation is not generated by gcc, but maybe future or by
> hand assembly.
>
> the relocation value is calculated correctly, overflow info kept while the
> overflow check is
> not enabled.
>
> pass native ld test.
>
> ok for trunk?
> thanks.
>
> bfd/
>   * elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check for
>   TLSLE_MOVW_TPREL_G2.
>
> ld/testsuite/
>   * ld-aarch64/tprel_g2_overflow.s: New testcase.
>   * ld-aarch64/tprel_g2_overflow.d: New expectation file.
>   * ld-aarch64/aarch64-elf.exp: Run new testcase.

OK /Marcus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-13 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12 15:00 [Patch, AArch64] Enable overflow check for TLSLE_MOVW_TPREL_G2 Jiong Wang
2015-01-13 10:34 ` 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).