aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfnn-aarch64.c6
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp3
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-270-overflow.d5
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-270-overflow.s6
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-270.d17
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-271-overflow.d5
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-271-overflow.s5
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-271.d17
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-272-overflow.d5
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-272-overflow.s5
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-272.d16
13 files changed, 79 insertions, 29 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0b52c17..8339eae 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-26 Renlin Li <renlin.li@arm.com>
+
+ * elfnn-aarch64.c (elfNN_aarch64_howto_table): Fix signed overflow
+ check for MOVW_SABS_G0, MOVW_SABS_G1, MOVW_SABS_G2.
+
2016-02-26 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19609
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 16a6eea..599b5f8 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -575,7 +575,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
HOWTO (AARCH64_R (MOVW_SABS_G0), /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
+ 17, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
@@ -590,7 +590,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
HOWTO64 (AARCH64_R (MOVW_SABS_G1), /* type */
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
+ 17, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
@@ -605,7 +605,7 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
HOWTO64 (AARCH64_R (MOVW_SABS_G2), /* type */
32, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
- 16, /* bitsize */
+ 17, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ef2e60f..24a913f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
+2016-02-26 Renlin Li <renlin.li@arm.com>
+
+ * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcases.
+ * testsuite/ld-aarch64/emit-relocs-270.d: Update to use new boundary.
+ * testsuite/ld-aarch64/emit-relocs-271.d: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-272.d: Likewise.
+ * testsuite/ld-aarch64/emit-relocs-270-overflow.d: New.
+ * testsuite/ld-aarch64/emit-relocs-270-overflow.s: New.
+ * testsuite/ld-aarch64/emit-relocs-271-overflow.d: New.
+ * testsuite/ld-aarch64/emit-relocs-271-overflow.s: New.
+ * testsuite/ld-aarch64/emit-relocs-272-overflow.d: New.
+ * testsuite/ld-aarch64/emit-relocs-272-overflow.s: New.
+
2016-02-26 H.J. Lu <hongjiu.lu@intel.com>
PR ld/19609
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index d0b33cf..37ce48c 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -96,8 +96,11 @@ run_dump_test "emit-relocs-269"
run_dump_test "emit-relocs-269-bad"
run_dump_test "emit-relocs-270"
run_dump_test "emit-relocs-270-bad"
+run_dump_test "emit-relocs-270-overflow"
run_dump_test "emit-relocs-271"
+run_dump_test "emit-relocs-271-overflow"
run_dump_test "emit-relocs-272"
+run_dump_test "emit-relocs-272-overflow"
run_dump_test "emit-relocs-273"
run_dump_test "emit-relocs-274"
run_dump_test "emit-relocs-275"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-270-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-270-overflow.d
new file mode 100644
index 0000000..991dc1f
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-270-overflow.d
@@ -0,0 +1,5 @@
+#source: emit-relocs-270-overflow.s
+#ld: -T relocs.ld --defsym tempy=0x10000 --defsym tempy1=-0x10001 -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_MOVW_SABS_G0 against symbol `tempy' .*
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_MOVW_SABS_G0 against symbol `tempy1' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-270-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-270-overflow.s
new file mode 100644
index 0000000..acc9b2d
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-270-overflow.s
@@ -0,0 +1,6 @@
+.comm gempy,4,4
+.text
+
+ movz x4, :abs_g0_s:tempy
+ movz x5, :abs_g0_s:tempy1
+
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-270.d b/ld/testsuite/ld-aarch64/emit-relocs-270.d
index 442150e..34f7a2a 100644
--- a/ld/testsuite/ld-aarch64/emit-relocs-270.d
+++ b/ld/testsuite/ld-aarch64/emit-relocs-270.d
@@ -1,14 +1,13 @@
#source: emit-relocs-270.s
-#ld: -T relocs.ld --defsym tempy=0x1012 --defsym tempy2=0x4500 --defsym tempy3=-292 -e0 --emit-relocs
-#objdump: -dr -Mno-aliases
+#ld: -T relocs.ld --defsym tempy=0xffff --defsym tempy2=0x4500 --defsym tempy3=-0x10000 -e0 --emit-relocs
+#objdump: -dr
#...
+10000: 8a000000 and x0, x0, x0
+10004: 92400000 and x0, x0, #0x1
- +10008: d2820244 movz x4, #0x1012
- +10008: R_AARCH64_MOVW_SABS_G0 tempy
- +1000c: d288a007 movz x7, #0x4500
- +1000c: R_AARCH64_MOVW_SABS_G0 tempy2
- +10010: 92802471 movn x17, #0x123
- +10010: R_AARCH64_MOVW_SABS_G0 tempy3
-
+ +10008: d29fffe4 mov x4, #0xffff // #65535
+ 10008: R_AARCH64_MOVW_SABS_G0 tempy
+ +1000c: d288a007 mov x7, #0x4500 // #17664
+ 1000c: R_AARCH64_MOVW_SABS_G0 tempy2
+ +10010: 929ffff1 mov x17, #0xffffffffffff0000 // #-65536
+ 10010: R_AARCH64_MOVW_SABS_G0 tempy3
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-271-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-271-overflow.d
new file mode 100644
index 0000000..b526ca4
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-271-overflow.d
@@ -0,0 +1,5 @@
+#source: emit-relocs-271-overflow.s
+#ld: -T relocs.ld --defsym tempy=0x100000000 --defsym tempy1=-0x100000001 -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_MOVW_SABS_G1 against symbol `tempy' .*
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_MOVW_SABS_G1 against symbol `tempy1' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-271-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-271-overflow.s
new file mode 100644
index 0000000..47d0686
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-271-overflow.s
@@ -0,0 +1,5 @@
+.comm gempy,4,4
+.text
+
+ movz x4, :abs_g1_s:tempy
+ movz x5, :abs_g1_s:tempy1
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-271.d b/ld/testsuite/ld-aarch64/emit-relocs-271.d
index 1f34820..f71cd02 100644
--- a/ld/testsuite/ld-aarch64/emit-relocs-271.d
+++ b/ld/testsuite/ld-aarch64/emit-relocs-271.d
@@ -1,14 +1,13 @@
#source: emit-relocs-271.s
-#ld: -T relocs.ld --defsym tempy=0x1012 --defsym tempy2=0x674500 --defsym tempy3=-292 -e0 --emit-relocs
-#objdump: -dr -Mno-aliases
+#ld: -T relocs.ld --defsym tempy=0xffffffff --defsym tempy2=0x674500 --defsym tempy3=-0x100000000 -e0 --emit-relocs
+#objdump: -dr
#...
+10000: 8a000000 and x0, x0, x0
+10004: 92400000 and x0, x0, #0x1
- +10008: d2a00004 movz x4, #0x0, lsl #16
- +10008: R_AARCH64_MOVW_SABS_G1 tempy
- +1000c: d2a00ce7 movz x7, #0x67, lsl #16
- +1000c: R_AARCH64_MOVW_SABS_G1 tempy2
- +10010: 92a00011 movn x17, #0x0, lsl #16
- +10010: R_AARCH64_MOVW_SABS_G1 tempy3
-
+ +10008: d2bfffe4 mov x4, #0xffff0000 // #4294901760
+ 10008: R_AARCH64_MOVW_SABS_G1 tempy
+ +1000c: d2a00ce7 mov x7, #0x670000 // #6750208
+ 1000c: R_AARCH64_MOVW_SABS_G1 tempy2
+ +10010: 92bffff1 mov x17, #0xffffffff0000ffff // #-4294901761
+ 10010: R_AARCH64_MOVW_SABS_G1 tempy3
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-272-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-272-overflow.d
new file mode 100644
index 0000000..a035554
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-272-overflow.d
@@ -0,0 +1,5 @@
+#source: emit-relocs-272-overflow.s
+#ld: -T relocs.ld --defsym tempy=0x1000000000000 --defsym tempy1=-0x1000000000001 -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_MOVW_SABS_G2 against symbol `tempy' .*
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_MOVW_SABS_G2 against symbol `tempy1' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-272-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-272-overflow.s
new file mode 100644
index 0000000..ac79465
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-272-overflow.s
@@ -0,0 +1,5 @@
+.comm gempy,4,4
+.text
+
+ movz x4, :abs_g2_s:tempy
+ movz x5, :abs_g2_s:tempy1
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-272.d b/ld/testsuite/ld-aarch64/emit-relocs-272.d
index 011ead5..94c037f 100644
--- a/ld/testsuite/ld-aarch64/emit-relocs-272.d
+++ b/ld/testsuite/ld-aarch64/emit-relocs-272.d
@@ -1,14 +1,14 @@
#source: emit-relocs-272.s
-#ld: -T relocs.ld --defsym tempy=0x1012 --defsym tempy2=-12345678912345 --defsym tempy3=-292 -e0 --emit-relocs
-#objdump: -dr -Mno-aliases
+#ld: -T relocs.ld --defsym tempy=0xffffffffffff --defsym tempy2=-12345678912345 --defsym tempy3=-0x1000000000000 -e0 --emit-relocs
+#objdump: -dr
#...
+10000: 8a000000 and x0, x0, x0
+10004: 92400000 and x0, x0, #0x1
- +10008: d2c00004 movz x4, #0x0, lsl #32
- +10008: R_AARCH64_MOVW_SABS_G2 tempy
- +1000c: 92c16747 movn x7, #0xb3a, lsl #32
- +1000c: R_AARCH64_MOVW_SABS_G2 tempy2
- +10010: 92c00011 movn x17, #0x0, lsl #32
- +10010: R_AARCH64_MOVW_SABS_G2 tempy3
+ +10008: d2dfffe4 mov x4, #0xffff00000000 // #281470681743360
+ 10008: R_AARCH64_MOVW_SABS_G2 tempy
+ +1000c: 92c16747 mov x7, #0xfffff4c5ffffffff // #-12343736008705
+ 1000c: R_AARCH64_MOVW_SABS_G2 tempy2
+ +10010: 92dffff1 mov x17, #0xffff0000ffffffff // #-281470681743361
+ 10010: R_AARCH64_MOVW_SABS_G2 tempy3