From f6e32f6db5fd9c527d978a27dbeef9f2f36f212a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 14 Mar 2011 15:53:33 +0000 Subject: bfd/ * elf32-arm.c (elf32_arm_check_relocs): Use call_reloc_p, may_need_local_target_p and may_become_dynamic_p to classify the relocation type. Don't check info->symbolic or h->def_regular when deciding whether to record a potential dynamic reloc. Don't treat potential dynamic relocs as PLT references. (elf32_arm_gc_sweep_hook): Update to match. Assert that we don't try to make the PLT reference count go negative. ld/testsuite/ * ld-arm/arm-lib-plt-2a.s, ld-arm/arm-lib-plt-2b.s, ld-arm/arm-lib-plt-2.dd, ld-arm/arm-lib-plt-2.rd: New tests. * ld-arm/arm-elf.exp: Run them. --- ld/testsuite/ChangeLog | 6 ++++++ ld/testsuite/ld-arm/arm-elf.exp | 8 ++++++++ ld/testsuite/ld-arm/arm-lib-plt-2.dd | 4 ++++ ld/testsuite/ld-arm/arm-lib-plt-2.rd | 6 ++++++ ld/testsuite/ld-arm/arm-lib-plt-2a.s | 5 +++++ ld/testsuite/ld-arm/arm-lib-plt-2b.s | 2 ++ 6 files changed, 31 insertions(+) create mode 100644 ld/testsuite/ld-arm/arm-lib-plt-2.dd create mode 100644 ld/testsuite/ld-arm/arm-lib-plt-2.rd create mode 100644 ld/testsuite/ld-arm/arm-lib-plt-2a.s create mode 100644 ld/testsuite/ld-arm/arm-lib-plt-2b.s (limited to 'ld') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index fdeaf77..d253267 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2011-03-14 Richard Sandiford + * ld-arm/arm-lib-plt-2a.s, ld-arm/arm-lib-plt-2b.s, + ld-arm/arm-lib-plt-2.dd, ld-arm/arm-lib-plt-2.rd: New tests. + * ld-arm/arm-elf.exp: Run them. + +2011-03-14 Richard Sandiford + * 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. diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index dcdc231..11ee575 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -80,6 +80,14 @@ set armelftests { {"Simple PIC shared library" "-shared" "" {arm-lib-plt32.s} {{objdump -fdw arm-lib-plt32.d} {objdump -Rw arm-lib-plt32.r}} "arm-lib-plt32.so"} + {"Indirect cross-library function reference (set-up)" + "-shared" "" {arm-lib-plt-2a.s} + {} + "arm-lib-plt-2a.so"} + {"Indirect cross-library function reference" + "-shared tmpdir/arm-lib-plt-2a.so" "" {arm-lib-plt-2b.s} + {{objdump -dr arm-lib-plt-2.dd} {readelf --relocs arm-lib-plt-2.rd}} + "arm-lib-plt-2b.so"} {"Simple dynamic application" "tmpdir/arm-lib.so" "" {arm-app.s} {{objdump -fdw arm-app.d} {objdump -Rw arm-app.r}} "arm-app"} diff --git a/ld/testsuite/ld-arm/arm-lib-plt-2.dd b/ld/testsuite/ld-arm/arm-lib-plt-2.dd new file mode 100644 index 0000000..fd61b73 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib-plt-2.dd @@ -0,0 +1,4 @@ + +.*: file format .* + +# There shouldn't be any code at all. diff --git a/ld/testsuite/ld-arm/arm-lib-plt-2.rd b/ld/testsuite/ld-arm/arm-lib-plt-2.rd new file mode 100644 index 0000000..3860bdd --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib-plt-2.rd @@ -0,0 +1,6 @@ + +Relocation section '.rel.dyn' .*: + Offset .* +.* R_ARM_ABS32 00000000 foo + +# There shouldn't be any .rel.plt relocations. diff --git a/ld/testsuite/ld-arm/arm-lib-plt-2a.s b/ld/testsuite/ld-arm/arm-lib-plt-2a.s new file mode 100644 index 0000000..6c8edac --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib-plt-2a.s @@ -0,0 +1,5 @@ + .globl foo + .type foo,%function +foo: + mov pc,lr + .size foo,.-foo diff --git a/ld/testsuite/ld-arm/arm-lib-plt-2b.s b/ld/testsuite/ld-arm/arm-lib-plt-2b.s new file mode 100644 index 0000000..fa5b135 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-lib-plt-2b.s @@ -0,0 +1,2 @@ + .data + .word foo -- cgit v1.1