PR23207, hppa ld SIGSEGVs on invalid object files

We don't create PLT call stubs for anything in non-alloc sections,
so it doesn't pay to go looking for them.  The problem is that
non-alloc sections aren't processed by group_sections and thus don't
get a link_sec set up for them.

	PR 23207
	* elf32-hppa.c (final_link_relocate): Don't look for plt call
	stubs in non-alloc sections.
This commit is contained in:
Alan Modra 2018-05-21 21:29:25 +09:30
parent 29e11a0437
commit 7455c018e4
2 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2018-05-22 Alan Modra <amodra@gmail.com>
PR 23207
* elf32-hppa.c (final_link_relocate): Don't look for plt call
stubs in non-alloc sections.
2018-05-21 H.J. Lu <hongjiu.lu@intel.com> 2018-05-21 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23201 PR ld/23201

View File

@ -3267,7 +3267,8 @@ final_link_relocate (asection *input_section,
case R_PARISC_PCREL22F: case R_PARISC_PCREL22F:
/* If this call should go via the plt, find the import stub in /* If this call should go via the plt, find the import stub in
the stub hash. */ the stub hash. */
if (sym_sec == NULL if ((input_section->flags & SEC_ALLOC) != 0
&& (sym_sec == NULL
|| sym_sec->output_section == NULL || sym_sec->output_section == NULL
|| (hh != NULL || (hh != NULL
&& hh->eh.plt.offset != (bfd_vma) -1 && hh->eh.plt.offset != (bfd_vma) -1
@ -3275,7 +3276,7 @@ final_link_relocate (asection *input_section,
&& !hh->plabel && !hh->plabel
&& (bfd_link_pic (info) && (bfd_link_pic (info)
|| !hh->eh.def_regular || !hh->eh.def_regular
|| hh->eh.root.type == bfd_link_hash_defweak))) || hh->eh.root.type == bfd_link_hash_defweak))))
{ {
hsh = hppa_get_stub_entry (input_section, sym_sec, hsh = hppa_get_stub_entry (input_section, sym_sec,
hh, rela, htab); hh, rela, htab);