From 62c34db3dc2a5a77d28853a650182a26f00896bb Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 14 Aug 2013 12:20:41 +0000 Subject: PR ld/15787 * elf32-arm.c (elf32_arm_final_link_relocate): Use origin of output segment containing the relocating symbol instead of assuming 0 for sb group relocations. * ld-arm/group-relocs-ldr-bad.s: Redefine bar into foo section beyond 16 bit offset width. * ld-arm/group-relocs-ldrs-bad.s: Likewise. * ld-arm/group-relocs-ldr-bad.d: Adjust expected result. * ld-arm/group-relocs-ldrs-bad.d: Likewise. * ld-arm/group-relocs.s: Add comments. Move symbols used for sb group relocations into .data section. Drop section zero. Use pc/r0 as base register when pc/sb group relocations are used. * ld-arm/group-relocs.d: Adjust expected result. * ld-arm/group-relocs-alu-bad-2.d: New test for sb group relocation. * ld-arm/group-relocs-ldc-bad-2.d: Likewise. * ld-arm/group-relocs-ldr-bad-2.d: New test for pc group relocation. * ld-arm/group-relocs-ldrs-bad-2.d: Likewise. * ld-arm/unresolved-2.d: Add sb relocation failure test. * ld-arm/group-relocs-alu-bad-2.s: New test source. * ld-arm/group-relocs-ldr-bad-2.s: Likewise. * ld-arm/group-relocs-ldrs-bad-2.s: Likewise. * ld-arm/group-relocs-ldc-bad-2.s: Likewise. * ld-arm/unresolved-2.s: Likewise. * ld-arm/arm-elf.exp: For group-relocs, drop section zero start definition. Run the new tests. --- ld/testsuite/ChangeLog | 25 +++++++++++++++++++++++++ ld/testsuite/ld-arm/arm-elf.exp | 1 + ld/testsuite/ld-arm/group-relocs-ldr-bad-2.d | 2 +- ld/testsuite/ld-arm/group-relocs-ldr-bad-2.s | 11 ++++++----- ld/testsuite/ld-arm/group-relocs-ldr-bad.d | 2 +- ld/testsuite/ld-arm/group-relocs-ldr-bad.s | 11 +++++------ ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.d | 2 +- ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.s | 10 +++++----- ld/testsuite/ld-arm/group-relocs-ldrs-bad.d | 2 +- ld/testsuite/ld-arm/group-relocs-ldrs-bad.s | 10 +++++----- ld/testsuite/ld-arm/unresolved-2.d | 5 +++++ ld/testsuite/ld-arm/unresolved-2.s | 5 +++++ 12 files changed, 61 insertions(+), 25 deletions(-) create mode 100644 ld/testsuite/ld-arm/unresolved-2.d create mode 100644 ld/testsuite/ld-arm/unresolved-2.s (limited to 'ld/testsuite') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 902e890..9d163ec 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2013-08-14 John Tytgat + + PR ld/15787 + * ld-arm/group-relocs-ldr-bad.s: Redefine bar into foo section + beyond 16 bit offset width. + * ld-arm/group-relocs-ldrs-bad.s: Likewise. + * ld-arm/group-relocs-ldr-bad.d: Adjust expected result. + * ld-arm/group-relocs-ldrs-bad.d: Likewise. + * ld-arm/group-relocs.s: Add comments. Move symbols used for sb + group relocations into .data section. Drop section zero. Use pc/r0 + as base register when pc/sb group relocations are used. + * ld-arm/group-relocs.d: Adjust expected result. + * ld-arm/group-relocs-alu-bad-2.d: New test for sb group relocation. + * ld-arm/group-relocs-ldc-bad-2.d: Likewise. + * ld-arm/group-relocs-ldr-bad-2.d: New test for pc group relocation. + * ld-arm/group-relocs-ldrs-bad-2.d: Likewise. + * ld-arm/unresolved-2.d: Add sb relocation failure test. + * ld-arm/group-relocs-alu-bad-2.s: New test source. + * ld-arm/group-relocs-ldr-bad-2.s: Likewise. + * ld-arm/group-relocs-ldrs-bad-2.s: Likewise. + * ld-arm/group-relocs-ldc-bad-2.s: Likewise. + * ld-arm/unresolved-2.s: Likewise. + * ld-arm/arm-elf.exp: For group-relocs, drop section zero start + definition. Run the new tests. + 2013-08-09 Nick Clifton * lib/ld-lib.exp (check_shared_lib_support): Note that the RL78 diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 3d7d761..4c0f802 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -836,4 +836,5 @@ run_dump_test "unresolved-1" if { ![istarget "arm*-*-nacl*"] } { run_dump_test "unresolved-1-dyn" } +run_dump_test "unresolved-2" run_dump_test "gc-hidden-1" diff --git a/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.d b/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.d index ae48b32..611d826 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.d +++ b/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.d @@ -1,4 +1,4 @@ #name: LDR group relocations failure test #source: group-relocs-ldr-bad-2.s #ld: -Ttext 0x8000 --section-start foo=0x8001000 -#error: .*Overflow whilst splitting 0x123456 for group relocation.* +#error: .*Overflow whilst splitting 0x7ff9000 for group relocation.* diff --git a/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.s b/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.s index 02d01c2..3aec8ee 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.s +++ b/ld/testsuite/ld-arm/group-relocs-ldr-bad-2.s @@ -6,12 +6,13 @@ .globl _start _start: - add r0, r0, #:sb_g0_nc:(bar) - ldr r1, [r0, #:sb_g1:(bar)] + add r0, r0, #:pc_g0_nc:(bar) + ldr r1, [r0, #:pc_g1:(bar + 4)] -@ We will place the section foo at 0x8001000 but that should be irrelevant -@ for sb_g* relocations. +@ We will place the section foo at 0x8001000. .section foo - .set bar,foo + 0x123456 + +bar: + mov r0, #0 diff --git a/ld/testsuite/ld-arm/group-relocs-ldr-bad.d b/ld/testsuite/ld-arm/group-relocs-ldr-bad.d index 88e6ee9..76f3df1 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldr-bad.d +++ b/ld/testsuite/ld-arm/group-relocs-ldr-bad.d @@ -1,4 +1,4 @@ #name: LDR group relocations failure test #source: group-relocs-ldr-bad.s #ld: -Ttext 0x8000 --section-start foo=0x8001000 -#error: .*Overflow whilst splitting 0x7ff9000 for group relocation.* +#error: .*Overflow whilst splitting 0x123456 for group relocation.* diff --git a/ld/testsuite/ld-arm/group-relocs-ldr-bad.s b/ld/testsuite/ld-arm/group-relocs-ldr-bad.s index 3aec8ee..02d01c2 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldr-bad.s +++ b/ld/testsuite/ld-arm/group-relocs-ldr-bad.s @@ -6,13 +6,12 @@ .globl _start _start: - add r0, r0, #:pc_g0_nc:(bar) - ldr r1, [r0, #:pc_g1:(bar + 4)] + add r0, r0, #:sb_g0_nc:(bar) + ldr r1, [r0, #:sb_g1:(bar)] -@ We will place the section foo at 0x8001000. +@ We will place the section foo at 0x8001000 but that should be irrelevant +@ for sb_g* relocations. .section foo - -bar: - mov r0, #0 + .set bar,foo + 0x123456 diff --git a/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.d b/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.d index 0674a15..9d1c900 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.d +++ b/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.d @@ -1,4 +1,4 @@ #name: LDRS group relocations failure test #source: group-relocs-ldrs-bad-2.s #ld: -Ttext 0x8000 --section-start foo=0x8000100 -#error: Overflow whilst splitting 0x123456 for group relocation +#error: Overflow whilst splitting 0x7ff8100 for group relocation diff --git a/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.s b/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.s index 02cf560..3578060 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.s +++ b/ld/testsuite/ld-arm/group-relocs-ldrs-bad-2.s @@ -6,12 +6,12 @@ .globl _start _start: - add r0, r0, #:sb_g0_nc:(bar) - ldrd r2, [r0, #:sb_g1:(bar)] + add r0, r0, #:pc_g0_nc:(bar) + ldrd r2, [r0, #:pc_g1:(bar + 4)] -@ We will place the section foo at 0x8000100 but that should be irrelevant -@ for sb_g* relocations. +@ We will place the section foo at 0x8000100. .section foo - .set bar,foo + 0x123456 +bar: + mov r0, #0 diff --git a/ld/testsuite/ld-arm/group-relocs-ldrs-bad.d b/ld/testsuite/ld-arm/group-relocs-ldrs-bad.d index ac7815b..e5296f9 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldrs-bad.d +++ b/ld/testsuite/ld-arm/group-relocs-ldrs-bad.d @@ -1,4 +1,4 @@ #name: LDRS group relocations failure test #source: group-relocs-ldrs-bad.s #ld: -Ttext 0x8000 --section-start foo=0x8000100 -#error: Overflow whilst splitting 0x7ff8100 for group relocation +#error: Overflow whilst splitting 0x123456 for group relocation diff --git a/ld/testsuite/ld-arm/group-relocs-ldrs-bad.s b/ld/testsuite/ld-arm/group-relocs-ldrs-bad.s index 3578060..02cf560 100644 --- a/ld/testsuite/ld-arm/group-relocs-ldrs-bad.s +++ b/ld/testsuite/ld-arm/group-relocs-ldrs-bad.s @@ -6,12 +6,12 @@ .globl _start _start: - add r0, r0, #:pc_g0_nc:(bar) - ldrd r2, [r0, #:pc_g1:(bar + 4)] + add r0, r0, #:sb_g0_nc:(bar) + ldrd r2, [r0, #:sb_g1:(bar)] -@ We will place the section foo at 0x8000100. +@ We will place the section foo at 0x8000100 but that should be irrelevant +@ for sb_g* relocations. .section foo + .set bar,foo + 0x123456 -bar: - mov r0, #0 diff --git a/ld/testsuite/ld-arm/unresolved-2.d b/ld/testsuite/ld-arm/unresolved-2.d new file mode 100644 index 0000000..cd5e013 --- /dev/null +++ b/ld/testsuite/ld-arm/unresolved-2.d @@ -0,0 +1,5 @@ +#name: SB relocations failure test +#source: unresolved-2.s +#ld: +#error: \(\.text\+0x0\): undefined reference to `foo' + diff --git a/ld/testsuite/ld-arm/unresolved-2.s b/ld/testsuite/ld-arm/unresolved-2.s new file mode 100644 index 0000000..92b7f7f --- /dev/null +++ b/ld/testsuite/ld-arm/unresolved-2.s @@ -0,0 +1,5 @@ + .text + .globl _start +_start: + ldr r1, [r0, #:sb_g0:(foo)] + -- cgit v1.1