bfd/arc: Rename enum entries to avoid conflicts

In bfd/elf32-arc.c an enum is created that contains entries with generic
names like 'NONE' and 'OFF'.  This has been fine for now, but I had a
need to include opcode/arc.h into bfd/elf32-arc.c.  Unfortunately
opcode/arc.h includes a different enum with identical generic names.

Given that changing the enum in the header file could mean wide-ranging
changes, while changing the enum in the .c file is limited to only
changing the one file, I've added a prefix to the enum in the .c file.

This commit does not add the new include, that will come later.  There
should be no functional change with this commit.

bfd/ChangeLog:

	* elf32-arc.c (tls_got_entries): Add 'TLS_GOT_' prefix to all
	entries.
	(elf_arc_relocate_section): Update enum uses.
	(elf_arc_check_relocs): Likewise.
	(elf_arc_finish_dynamic_symbol): Likewise.
This commit is contained in:
Andrew Burgess 2016-04-06 18:55:23 +01:00
parent cb040366b3
commit 33cbe6c07e
2 changed files with 25 additions and 17 deletions

View File

@ -1,3 +1,11 @@
2016-04-14 Andrew Burgess <andrew.burgess@embecosm.com>
* elf32-arc.c (tls_got_entries): Add 'TLS_GOT_' prefix to all
entries.
(elf_arc_relocate_section): Update enum uses.
(elf_arc_check_relocs): Likewise.
(elf_arc_finish_dynamic_symbol): Likewise.
2016-04-14 H.J. Lu <hongjiu.lu@intel.com>
* elf.c (_bfd_elf_copy_private_bfd_data): Replace "link" with

View File

@ -127,10 +127,10 @@ enum tls_type_e
enum tls_got_entries
{
NONE = 0,
MOD,
OFF,
MOD_AND_OFF
TLS_GOT_NONE = 0,
TLS_GOT_MOD,
TLS_GOT_OFF,
TLS_GOT_MOD_AND_OFF
};
struct got_entry
@ -1401,7 +1401,7 @@ elf_arc_relocate_section (bfd * output_bfd,
bfd_put_32 (output_bfd,
sym_value - sec_vma,
htab->sgot->contents + entry->offset
+ (entry->existing_entries == MOD_AND_OFF ? 4 : 0));
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF ? 4 : 0));
ARC_DEBUG ("arc_info: FIXED -> %s value = 0x%x "
"@ 0x%x, for symbol %s\n",
@ -1409,7 +1409,7 @@ elf_arc_relocate_section (bfd * output_bfd,
"GOT_TLS_IE"),
sym_value - sec_vma,
htab->sgot->contents + entry->offset
+ (entry->existing_entries == MOD_AND_OFF ? 4 : 0),
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF ? 4 : 0),
h->root.root.string);
entry->processed = TRUE;
@ -1806,7 +1806,7 @@ elf_arc_check_relocs (bfd * abfd,
bfd_link_pic (info),
NULL);
new_got_entry_to_list (&(local_got_ents[r_symndx]),
GOT_NORMAL, offset, NONE);
GOT_NORMAL, offset, TLS_GOT_NONE);
}
}
else
@ -1818,7 +1818,7 @@ elf_arc_check_relocs (bfd * abfd,
bfd_vma offset =
ADD_SYMBOL_REF_SEC_AND_RELOC (got, TRUE, h);
new_got_entry_to_list (&h->got.glist,
GOT_NORMAL, offset, NONE);
GOT_NORMAL, offset, TLS_GOT_NONE);
}
}
}
@ -1847,7 +1847,7 @@ elf_arc_check_relocs (bfd * abfd,
if (type != GOT_UNKNOWN && !symbol_has_entry_of_type (*list, type))
{
enum tls_got_entries entries = NONE;
enum tls_got_entries entries = TLS_GOT_NONE;
bfd_vma offset =
ADD_SYMBOL_REF_SEC_AND_RELOC (got, TRUE, h);
@ -1855,11 +1855,11 @@ elf_arc_check_relocs (bfd * abfd,
{
bfd_vma ATTRIBUTE_UNUSED notneeded =
ADD_SYMBOL_REF_SEC_AND_RELOC (got, TRUE, h);
entries = MOD_AND_OFF;
entries = TLS_GOT_MOD_AND_OFF;
}
if (entries == NONE)
entries = OFF;
if (entries == TLS_GOT_NONE)
entries = TLS_GOT_OFF;
new_got_entry_to_list (list, type, offset, entries);
}
@ -2256,16 +2256,16 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
}
list->created_dyn_relocation = TRUE;
}
else if (list->existing_entries != NONE)
else if (list->existing_entries != TLS_GOT_NONE)
{
struct elf_link_hash_table *htab = elf_hash_table (info);
enum tls_got_entries e = list->existing_entries;
BFD_ASSERT (list->type != GOT_TLS_GD
|| list->existing_entries == MOD_AND_OFF);
|| list->existing_entries == TLS_GOT_MOD_AND_OFF);
bfd_vma dynindx = h->dynindx == -1 ? 0 : h->dynindx;
if (e == MOD_AND_OFF || e == MOD)
if (e == TLS_GOT_MOD_AND_OFF || e == TLS_GOT_MOD)
{
ADD_RELA (output_bfd, got, got_offset, dynindx,
R_ARC_TLS_DTPMOD, 0);
@ -2277,7 +2277,7 @@ GOT_OFFSET = 0x%x, GOT_VMA = 0x%x, INDEX = %d, ADDEND = 0x%x\n",
+ htab->sgot->output_offset + got_offset,
dynindx, 0);
}
if (e == MOD_AND_OFF || e == OFF)
if (e == TLS_GOT_MOD_AND_OFF || e == TLS_GOT_OFF)
{
bfd_vma addend = 0;
if (list->type == GOT_TLS_IE)
@ -2285,7 +2285,7 @@ GOT_OFFSET = 0x%x, GOT_VMA = 0x%x, INDEX = %d, ADDEND = 0x%x\n",
htab->sgot->contents + got_offset);
ADD_RELA (output_bfd, got,
got_offset + (e == MOD_AND_OFF ? 4 : 0),
got_offset + (e == TLS_GOT_MOD_AND_OFF ? 4 : 0),
dynindx,
(list->type == GOT_TLS_IE ?
R_ARC_TLS_TPOFF : R_ARC_TLS_DTPOFF),