* elf32-arm.c (elf32_arm_gc_sweep_hook): Remove all registered
	dynamic relocs for the removed section.

ld/testsuite/
	* ld-arm/gc-thumb-lib.s, ld-arm/gc-thumb.s,
	ld-arm/gc-thumb.d: New test.
	* ld-arm/arm-elf.exp: Run it.
This commit is contained in:
Richard Sandiford 2011-01-17 16:36:15 +00:00
parent f55af66d6e
commit 1e81e12b2c
7 changed files with 43 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2011-01-17 Richard Sandiford <richard.sandiford@linaro.org>
* elf32-arm.c (elf32_arm_gc_sweep_hook): Remove all registered
dynamic relocs for the removed section.
2011-01-15 H.J. Lu <hongjiu.lu@intel.com>
* elf64-x86-64.c (elf_x86_64_check_relocs): Check invalid x32

View File

@ -11277,21 +11277,13 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
eh->plt_thumb_refcount--;
}
if (r_type == R_ARM_ABS32
|| r_type == R_ARM_REL32
|| r_type == R_ARM_ABS32_NOI
|| r_type == R_ARM_REL32_NOI)
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
if (p->sec == sec)
{
p->count -= 1;
if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32
|| ELF32_R_TYPE (rel->r_info) == R_ARM_REL32_NOI)
p->pc_count -= 1;
if (p->count == 0)
*pp = p->next;
break;
}
for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
if (p->sec == sec)
{
/* Everything must go for SEC. */
*pp = p->next;
break;
}
}
break;

View File

@ -1,3 +1,9 @@
2011-01-17 Richard Sandiford <richard.sandiford@linaro.org>
* ld-arm/gc-thumb-lib.s, ld-arm/gc-thumb.s,
ld-arm/gc-thumb.d: New test.
* ld-arm/arm-elf.exp: Run it.
2011-01-14 H.J. Lu <hongjiu.lu@intel.com>
* ld-x86-64/ia32-2.d: Replace --n32 with --x32.

View File

@ -261,6 +261,12 @@ set armelftests {
{"Unwinding and -gc-sections" "-gc-sections" "" {gc-unwind.s}
{{objdump -sj.data gc-unwind.d}}
"gc-unwind"}
{"Thumb and -gc-sections" "-shared -T arm-dyn.ld" "" {gc-thumb-lib.s}
{}
"gc-thumb-lib.so"}
{"Thumb and -gc-sections" "-pie -T arm.ld -gc-sections tmpdir/gc-thumb-lib.so" "" {gc-thumb.s}
{{readelf --relocs gc-thumb.d}}
"gc-thumb"}
{"arm-pic-veneer" "-static -T arm.ld --pic-veneer" "" {arm-pic-veneer.s}
{{objdump -d arm-pic-veneer.d}}
"arm-pic-veneer"}

View File

@ -0,0 +1,6 @@
.data
.globl foo
.type foo,%object
.size foo,4
foo:
.word 0

View File

@ -0,0 +1,2 @@
There are no relocations in this file\.

View File

@ -0,0 +1,11 @@
.arch armv7-a
.syntax unified
.text
.globl _start
_start:
mov pc,lr
.section .text.foo,"ax",%progbits
.thumb
movw r0,#:lower16:foo-.
movt r0,#:upper16:foo-.