This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PING PATCH] arc: Fix segfault when generating got entries for local symbols
- From: Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: "Claudiu dot Zissulescu at synopsys dot com" <Claudiu dot Zissulescu at synopsys dot com>, Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>
- Date: Fri, 22 Jul 2016 12:45:19 +0000
- Subject: Re: [PING PATCH] arc: Fix segfault when generating got entries for local symbols
- Authentication-results: sourceware.org; auth=none
- References: <1468442629-16486-1-git-send-email-andrew.burgess@embecosm.com>
Hi everyone,
This patch is still needing approval by someone.
Nick: Do you approve and apply, perhaps ? :-)
Best regards,
Cupertino
On 07/13/2016 10:44 PM, Andrew Burgess wrote:
> Commit 08759e0fc8b0de1c56ad388212a104f3a6d61c25 (Fixes done to TLS)
> introduced a segfault when generating got entries for local symbols.
> Fixed in this commit and a test added.
>
> bfd/ChangeLog:
>
> * arc-got.h (relocate_fix_got_relocs_for_got_info): Handle the case
> where there's no elf_link_hash_entry while processing GOT_NORMAL got
> entries.
>
> ld/ChangeLog:
>
> * testsuite/ld-arc/got-01.d: New file.
> * testsuite/ld-arc/got-01.s: New file.
> ---
> bfd/ChangeLog | 6 ++++++
> bfd/arc-got.h | 22 ++++++++++------------
> ld/ChangeLog | 5 +++++
> ld/testsuite/ld-arc/got-01.d | 7 +++++++
> ld/testsuite/ld-arc/got-01.s | 5 +++++
> 5 files changed, 33 insertions(+), 12 deletions(-)
> create mode 100644 ld/testsuite/ld-arc/got-01.d
> create mode 100644 ld/testsuite/ld-arc/got-01.s
>
> diff --git a/bfd/arc-got.h b/bfd/arc-got.h
> index 9e8fd10..0571400 100644
> --- a/bfd/arc-got.h
> +++ b/bfd/arc-got.h
> @@ -367,12 +367,20 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **list_p,
> = reloc_data->sym_section->output_section->vma
> + reloc_data->sym_section->output_offset;
>
> - if (h->root.type != bfd_link_hash_undefweak)
> + if (h != NULL
> + && h->root.type == bfd_link_hash_undefweak)
> + ARC_DEBUG ("arc_info: PATCHED: NOT_PATCHED "
> + "@ 0x%08x for sym %s in got offset 0x%x "
> + "(is undefweak)\n",
> + htab->sgot->output_section->vma
> + + htab->sgot->output_offset + entry->offset,
> + symbol_name,
> + entry->offset);
> + else
> {
> bfd_put_32 (output_bfd,
> reloc_data->sym_value + sec_vma,
> htab->sgot->contents + entry->offset);
> -
> ARC_DEBUG ("arc_info: PATCHED: 0x%08x "
> "@ 0x%08x for sym %s in got offset 0x%x\n",
> reloc_data->sym_value + sec_vma,
> @@ -381,16 +389,6 @@ relocate_fix_got_relocs_for_got_info (struct got_entry **list_p,
> symbol_name,
> entry->offset);
> }
> - else
> - {
> - ARC_DEBUG ("arc_info: PATCHED: NOT_PATCHED "
> - "@ 0x%08x for sym %s in got offset 0x%x "
> - "(is undefweak)\n",
> - htab->sgot->output_section->vma
> - + htab->sgot->output_offset + entry->offset,
> - symbol_name,
> - entry->offset);
> - }
> }
> break;
> default:
> diff --git a/ld/testsuite/ld-arc/got-01.d b/ld/testsuite/ld-arc/got-01.d
> new file mode 100644
> index 0000000..b9d156e
> --- /dev/null
> +++ b/ld/testsuite/ld-arc/got-01.d
> @@ -0,0 +1,7 @@
> +#source: got-01.s
> +#as: -mcpu=arc700
> +#ld:
> +#readelf: -S
> +
> +There are 9 section headers, starting at offset 0x[0-9a-f]+:
> +#...
> \ No newline at end of file
> diff --git a/ld/testsuite/ld-arc/got-01.s b/ld/testsuite/ld-arc/got-01.s
> new file mode 100644
> index 0000000..4e1b406
> --- /dev/null
> +++ b/ld/testsuite/ld-arc/got-01.s
> @@ -0,0 +1,5 @@
> + .text
> + .global __start
> +__start:
> +foo:
> + ld r0, [pcl, foo@gotpc]