diff options
author | Renlin Li <renlin.li@arm.com> | 2016-02-26 17:52:34 +0000 |
---|---|---|
committer | Renlin Li <renlin.li@arm.com> | 2016-02-26 18:00:15 +0000 |
commit | c5e3a3641ea9d6ed2918021fd77925825d24e9be (patch) | |
tree | a058e83c984b3c516e5ca9005343884bb4a3af6b /ld | |
parent | bae420ef26f4331415b0503141c5931318025906 (diff) | |
download | gdb-c5e3a3641ea9d6ed2918021fd77925825d24e9be.zip gdb-c5e3a3641ea9d6ed2918021fd77925825d24e9be.tar.gz gdb-c5e3a3641ea9d6ed2918021fd77925825d24e9be.tar.bz2 |
[BFD][AARCH64]Fix MOVW_SABS_G(0,1,2) relocation overflow check.
For these three relocations, 17 bit signed value should be used, instead of
16 bit. The bitsize field is changed from 16 to 17, this field in aarch64
backend is used for overflow check only.
bfd/
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.
ld/
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.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/aarch64-elf.exp | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-270-overflow.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-270-overflow.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-270.d | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-271-overflow.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-271-overflow.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-271.d | 17 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-272-overflow.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-272-overflow.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-272.d | 16 |
11 files changed, 71 insertions, 26 deletions
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 |