aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-hppa.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-05-28 08:41:56 +0930
committerAlan Modra <amodra@gmail.com>2019-05-28 10:55:41 +0930
commit586338b839d3f65d22eb3baef41f7395974f1f11 (patch)
treebfad34ec6b3a599675f821d82202dbf8a71cc56f /bfd/elf64-hppa.c
parenta7b34aba62ce347b4e64ca197a5c8b997e3b72df (diff)
downloadgdb-586338b839d3f65d22eb3baef41f7395974f1f11.zip
gdb-586338b839d3f65d22eb3baef41f7395974f1f11.tar.gz
gdb-586338b839d3f65d22eb3baef41f7395974f1f11.tar.bz2
HPPA64 linker segmentation faults
One of the ld tests produces: failed with: <Segmentation fault>, no expected output FAIL: Discarded dynamic relocation section This patch cures the segv. (The test still fails with ld producing a really messed up output, DT_RELA at address 0!) PR 24596 * elf64-hppa.c (elf64_hppa_finalize_dynreloc): Get the output bfd from bfd_link_info, not an output section owner. (elf64_hppa_finish_dynamic_symbol, elf64_hppa_finalize_opd): Likewise. (elf_hppa_final_link_relocate): Likewise.
Diffstat (limited to 'bfd/elf64-hppa.c')
-rw-r--r--bfd/elf64-hppa.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 6dc083f..9f6a513 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -2011,7 +2011,7 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd,
in the output_offset of the PLT section. */
bfd_put_64 (splt->owner, value, splt->contents + hh->plt_offset);
- value = _bfd_get_gp_value (splt->output_section->owner);
+ value = _bfd_get_gp_value (info->output_bfd);
bfd_put_64 (splt->owner, value, splt->contents + hh->plt_offset + 0x8);
/* Create a dynamic IPLT relocation for this entry.
@@ -2027,7 +2027,7 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd,
loc = spltrel->contents;
loc += spltrel->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (splt->output_section->owner, &rel, loc);
+ bfd_elf64_swap_reloca_out (info->output_bfd, &rel, loc);
}
/* Initialize an external call stub entry if requested. */
@@ -2143,7 +2143,7 @@ elf64_hppa_finalize_opd (struct elf_link_hash_entry *eh, void *data)
bfd_put_64 (sopd->owner, value, sopd->contents + hh->opd_offset + 16);
/* The last word is our local __gp value. */
- value = _bfd_get_gp_value (sopd->output_section->owner);
+ value = _bfd_get_gp_value (info->output_bfd);
bfd_put_64 (sopd->owner, value, sopd->contents + hh->opd_offset + 24);
}
@@ -2220,7 +2220,7 @@ elf64_hppa_finalize_opd (struct elf_link_hash_entry *eh, void *data)
loc = sopdrel->contents;
loc += sopdrel->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (sopd->output_section->owner, &rel, loc);
+ bfd_elf64_swap_reloca_out (info->output_bfd, &rel, loc);
}
return TRUE;
}
@@ -2315,7 +2315,7 @@ elf64_hppa_finalize_dlt (struct elf_link_hash_entry *eh, void *data)
loc = sdltrel->contents;
loc += sdltrel->reloc_count++ * sizeof (Elf64_External_Rela);
- bfd_elf64_swap_reloca_out (sdlt->output_section->owner, &rel, loc);
+ bfd_elf64_swap_reloca_out (info->output_bfd, &rel, loc);
}
return TRUE;
}
@@ -2431,8 +2431,7 @@ elf64_hppa_finalize_dynreloc (struct elf_link_hash_entry *eh,
loc = hppa_info->other_rel_sec->contents;
loc += (hppa_info->other_rel_sec->reloc_count++
* sizeof (Elf64_External_Rela));
- bfd_elf64_swap_reloca_out (hppa_info->other_rel_sec->output_section->owner,
- &rel, loc);
+ bfd_elf64_swap_reloca_out (info->output_bfd, &rel, loc);
}
}
@@ -3381,8 +3380,7 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
(hppa_info->opd_sec->contents + off + 16));
/* The last word is our local __gp value. */
- value = _bfd_get_gp_value
- (hppa_info->opd_sec->output_section->owner);
+ value = _bfd_get_gp_value (info->output_bfd);
bfd_put_64 (hppa_info->opd_sec->owner, value,
(hppa_info->opd_sec->contents + off + 24));
}
@@ -3591,8 +3589,7 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
+ hh->opd_offset + 16));
/* The last word is our local __gp value. */
- value = _bfd_get_gp_value
- (hppa_info->opd_sec->output_section->owner);
+ value = _bfd_get_gp_value (info->output_bfd);
bfd_put_64 (hppa_info->opd_sec->owner, value,
hppa_info->opd_sec->contents + hh->opd_offset + 24);
@@ -3718,8 +3715,7 @@ elf_hppa_final_link_relocate (Elf_Internal_Rela *rel,
(hppa_info->opd_sec->contents + off + 16));
/* The last word is our local __gp value. */
- value = _bfd_get_gp_value
- (hppa_info->opd_sec->output_section->owner);
+ value = _bfd_get_gp_value (info->output_bfd);
bfd_put_64 (hppa_info->opd_sec->owner, value,
hppa_info->opd_sec->contents + off + 24);
}