This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 3/5] Several fixes related to ARC PIE support.
- From: Nick Clifton <nickc at redhat dot com>
- To: Cupertino Miranda <Cupertino dot Miranda at synopsys dot com>, binutils at sourceware dot org
- Cc: Francois dot Bedard at synopsys dot com, Claudiu dot Zissulescu at synopsys dot com
- Date: Fri, 19 Aug 2016 08:53:10 +0100
- Subject: Re: [PATCH 3/5] Several fixes related to ARC PIE support.
- Authentication-results: sourceware.org; auth=none
- References: <20160816155116.23937-1-cmiranda@synopsys.com> <20160816155116.23937-4-cmiranda@synopsys.com>
Hi Cupertino,
> bfd/ChangeLog:
> Cupertino Miranda <cmiranda@synopsys.com>
>
> elf-bfd.h: Added ARC_ELF_DATA to enum elf_target_id.
> elf32-arc.c (struct elf_arc_link_hash_entry): Added.
> (struct elf_arc_link_hash_table): Likewise.
> (elf_arc_link_hash_newfunc): Likewise.
> (elf_arc_link_hash_table_free): Likewise.
> (arc_elf_link_hash_table_create): Likewise.
> (elf_arc_relocate_section): Fixed conditions related to dynamic
> (elf_arc_check_relocs): Likewise.
> (arc_elf_create_dynamic_sections): Added
> (elf_arc_adjust_dynamic_symbol): Changed access to .rela.bss to be done
> through the hash table.
One minor point and one question:
> +/* Create an X86-64 ELF linker hash table. */
Cut and paste typo - I assume that you meant 'Create an ARC ELF linker hash table'.
> @@ -2020,17 +2148,21 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
>
> if (h->needs_copy)
> {
> + struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
> +
> + if (h->dynindx == -1
> + || (h->root.type != bfd_link_hash_defined
> + && h->root.type != bfd_link_hash_defweak)
> + || arc_htab->srelbss == NULL)
> + abort ();
I am not sure if an abort is the correct function to call here. Abort should
only be called if there is an internal error in the library. If it is possible
for bad user input to trigger the situation then an error message should be
generated instead. I have not followed through all the logic, so maybe the
conditions being tested should all be satisfied by earlier parts in the linking
process, (in which case a BFD_ASSERT would be better than a direct call to abort),
but it seems to me that it might be possible for a dynamic symbol to become
undefined somehow, and in that case an error message would be more appropriate.
Cheers
Nick