[AArch64] Enable overflow check for TLSLE_MOVW_TPREL_G2
authorJiong Wang <jiong.wang@arm.com>
Tue, 13 Jan 2015 11:21:43 +0000 (11:21 +0000)
committerJiong Wang <jiong.wang@arm.com>
Tue, 13 Jan 2015 11:21:43 +0000 (11:21 +0000)
  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.

bfd/ChangeLog
bfd/elfnn-aarch64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/tprel_g2_overflow.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/tprel_g2_overflow.s [new file with mode: 0644]

index e7630abcc1306b1998e856a52ec83e3887b8b308..b43a491117ee9257f82e7233926eb7fb53ee0825 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-13  Jiong Wang  <jiong.wang@arm.com>
+
+       * elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check
+       for TLSLE_MOVW_TPREL_G2.
+
 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
 
        PR ld/17415
index f632eee0dd09d495a1679f9eacc49e1799efaa07..c8401c15fe391158b2db21336ea71e1a9a523d44 100644 (file)
@@ -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 */
index 14cd6f6c1ec5d6642b7528a45198c291d237c8f0..27f8bc302aee068aee452ae93b8a3bdc5d958baa 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-13  Jiong Wang  <jiong.wang@arm.com>
+
+       * 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.
+
 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
 
        PR ld/17415
index 9b715bbf8d357398777b24fd7ad06c6afae5de08..7d421a5faf4f8d17eedf8f6cdcaa323552f274b9 100644 (file)
@@ -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 (file)
index 0000000..8dcbe87
--- /dev/null
@@ -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 (file)
index 0000000..d94a30d
--- /dev/null
@@ -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