[PATCH 3/5] Several fixes related to ARC PIE support.

Nick Clifton nickc@redhat.com
Fri Aug 19 07:53:00 GMT 2016


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



More information about the Binutils mailing list