diff options
author | Richard Sandiford <rsandifo@nildram.co.uk> | 2011-03-14 15:52:51 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@nildram.co.uk> | 2011-03-14 15:52:51 +0000 |
commit | c82752d7ebdb347961edea2bdcdada0d0e7f4f7b (patch) | |
tree | 0faf0a10f128941dff335729767740cf95623890 /ld/testsuite/ld-arm | |
parent | 383adf91e69323c38dd4b41e9fa27cc300082b19 (diff) | |
download | binutils-redhat-c82752d7ebdb347961edea2bdcdada0d0e7f4f7b.tar.gz |
bfd/
* elf32-arm.c (elf32_arm_final_link_relocate): Always fill in the
GOT entry here, rather than leaving it to finish_dynamic_symbol.
Only create a dynamic relocation for local references if
info->shared.
(allocate_dynrelocs_for_symbol): Update dynamic relocation
allocation accordingly.
(elf32_arm_finish_dynamic_symbol): Don't initialise the GOT entry here.
ld/testsuite/
* ld-arm/exec-got-1a.s, ld-arm/exec-got-1b.s, ld-arm/exec-got-1.d,
ld-arm/unresolved-1.s, ld-arm/unresolved-1.d,
ld-arm/unresolved-1-dyn.d: New tests.
* ld-arm/arm-elf.exp: Run them.
Diffstat (limited to 'ld/testsuite/ld-arm')
-rw-r--r-- | ld/testsuite/ld-arm/arm-elf.exp | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/exec-got-1.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/exec-got-1a.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/exec-got-1b.s | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/unresolved-1-dyn.d | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/unresolved-1.d | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/unresolved-1.s | 6 |
7 files changed, 51 insertions, 0 deletions
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 798b2cb5af..dcdc2310d4 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -295,6 +295,14 @@ set armelftests { {"Data only mapping symbols" "-T data-only-map.ld -Map map" "" {data-only-map.s} {{objdump -dr data-only-map.d}} "data-only-map"} + {"GOT relocations in executables (setup)" "-shared" + "" {exec-got-1a.s} + {} + "exec-got-1.so"} + {"GOT relocations in executables" "tmpdir/exec-got-1.so" + "" {exec-got-1b.s} + {{readelf --relocs exec-got-1.d}} + "exec-got-1"} } run_ld_link_tests $armelftests @@ -582,3 +590,5 @@ run_dump_test "attr-merge-vfp-5r" run_dump_test "attr-merge-vfp-6" run_dump_test "attr-merge-vfp-6r" run_dump_test "attr-merge-incompatible" +run_dump_test "unresolved-1" +run_dump_test "unresolved-1-dyn" diff --git a/ld/testsuite/ld-arm/exec-got-1.d b/ld/testsuite/ld-arm/exec-got-1.d new file mode 100644 index 0000000000..af067d3dd2 --- /dev/null +++ b/ld/testsuite/ld-arm/exec-got-1.d @@ -0,0 +1,4 @@ + +Relocation section '\.rel\.dyn' .* + Offset .* +.* R_ARM_GLOB_DAT * 00000000 * foo diff --git a/ld/testsuite/ld-arm/exec-got-1a.s b/ld/testsuite/ld-arm/exec-got-1a.s new file mode 100644 index 0000000000..6a7637c2fb --- /dev/null +++ b/ld/testsuite/ld-arm/exec-got-1a.s @@ -0,0 +1,5 @@ + .globl foo + .type foo,%object + .size foo,4 + .data +foo: .word 1 diff --git a/ld/testsuite/ld-arm/exec-got-1b.s b/ld/testsuite/ld-arm/exec-got-1b.s new file mode 100644 index 0000000000..71546d74a0 --- /dev/null +++ b/ld/testsuite/ld-arm/exec-got-1b.s @@ -0,0 +1,10 @@ + .globl _start + .type _start,%function +_start: + ldr r1,1f + ldr r1,2f +1: + .word foo(GOT) +2: + .word _start(GOT) + .size _start,.-_start diff --git a/ld/testsuite/ld-arm/unresolved-1-dyn.d b/ld/testsuite/ld-arm/unresolved-1-dyn.d new file mode 100644 index 0000000000..21cd9599c6 --- /dev/null +++ b/ld/testsuite/ld-arm/unresolved-1-dyn.d @@ -0,0 +1,8 @@ +#source: unresolved-1.s +#ld: --warn-unresolved tmpdir/mixed-lib.so +#warning: \(\.text\+0x8\): warning: undefined reference to `foo' +#readelf: -r + +Relocation section '\.rel\.dyn' .* + Offset .* +.* R_ARM_GLOB_DAT +00000000 +foo diff --git a/ld/testsuite/ld-arm/unresolved-1.d b/ld/testsuite/ld-arm/unresolved-1.d new file mode 100644 index 0000000000..cfc1b04c0d --- /dev/null +++ b/ld/testsuite/ld-arm/unresolved-1.d @@ -0,0 +1,8 @@ +#ld: --warn-unresolved +#warning: \(\.text\+0x8\): warning: undefined reference to `foo' +#objdump: -sj.rel.dyn -sj.got + +.* + +Contents of section \.got: + *[^ ]* 00000000 00000000 00000000 00000000 .* diff --git a/ld/testsuite/ld-arm/unresolved-1.s b/ld/testsuite/ld-arm/unresolved-1.s new file mode 100644 index 0000000000..4db4aea840 --- /dev/null +++ b/ld/testsuite/ld-arm/unresolved-1.s @@ -0,0 +1,6 @@ + .globl _start +_start: + ldr r4,1f + mov pc,lr +1: + .word foo(GOT) |