aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-08-14 12:20:41 +0000
committerNick Clifton <nickc@redhat.com>2013-08-14 12:20:41 +0000
commit62c34db3dc2a5a77d28853a650182a26f00896bb (patch)
treecf955dc3e99195e200fb0ca6ed0813f9df9e9404 /bfd/elf32-arm.c
parentfde605f3823b735b0505ab8e66ca0e3a6a327281 (diff)
downloadgdb-62c34db3dc2a5a77d28853a650182a26f00896bb.zip
gdb-62c34db3dc2a5a77d28853a650182a26f00896bb.tar.gz
gdb-62c34db3dc2a5a77d28853a650182a26f00896bb.tar.bz2
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.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r--bfd/elf32-arm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 4616ae9..6d2d553 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -9853,7 +9853,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_vma pc = input_section->output_section->vma
+ input_section->output_offset + rel->r_offset;
/* sb is the origin of the *segment* containing the symbol. */
- bfd_vma sb = sym_sec->output_section->vma;
+ bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
bfd_vma residual;
bfd_vma g_n;
bfd_signed_vma signed_value;
@@ -9987,7 +9987,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_vma pc = input_section->output_section->vma
+ input_section->output_offset + rel->r_offset;
/* sb is the origin of the *segment* containing the symbol. */
- bfd_vma sb = sym_sec->output_section->vma;
+ bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
bfd_vma residual;
bfd_signed_vma signed_value;
int group = 0;
@@ -10071,7 +10071,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_vma pc = input_section->output_section->vma
+ input_section->output_offset + rel->r_offset;
/* sb is the origin of the *segment* containing the symbol. */
- bfd_vma sb = sym_sec->output_section->vma;
+ bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
bfd_vma residual;
bfd_signed_vma signed_value;
int group = 0;
@@ -10155,7 +10155,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
bfd_vma pc = input_section->output_section->vma
+ input_section->output_offset + rel->r_offset;
/* sb is the origin of the *segment* containing the symbol. */
- bfd_vma sb = sym_sec->output_section->vma;
+ bfd_vma sb = sym_sec ? sym_sec->output_section->vma : 0;
bfd_vma residual;
bfd_signed_vma signed_value;
int group = 0;