public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: binutils@sourceware.org
Cc: Claudiu.Zissulescu@synopsys.com,	Cupertino.Miranda@synopsys.com,
	noamca@mellanox.com,	Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCH 2/3] bfd/arc: Rename enum entries to avoid conflicts
Date: Thu, 07 Apr 2016 11:05:00 -0000	[thread overview]
Message-ID: <1460027127-1121-3-git-send-email-andrew.burgess@embecosm.com> (raw)
In-Reply-To: <1460027127-1121-1-git-send-email-andrew.burgess@embecosm.com>

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.
---
 bfd/ChangeLog   |  8 ++++++++
 bfd/elf32-arc.c | 34 +++++++++++++++++-----------------
 2 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 323f65d..263effc 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -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),
-- 
2.5.1

  reply	other threads:[~2016-04-07 11:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 11:00 [PATCHv2 0/3] ARC: Add another group of nps instructions Andrew Burgess
2016-04-07 11:05 ` [PATCH " Andrew Burgess
2016-04-07 11:05   ` Andrew Burgess [this message]
2016-04-07 11:20     ` [PATCH 2/3] bfd/arc: Rename enum entries to avoid conflicts Claudiu Zissulescu
2016-04-07 11:05   ` [PATCH 1/3] opcodes/arc: Compute insn lengths in disassembler Andrew Burgess
2016-04-07 11:27     ` Claudiu Zissulescu
2016-04-12  9:27     ` Claudiu Zissulescu
2016-04-07 11:05   ` [PATCH 3/3] arc/nps400 : New cmem instructions and associated relocation Andrew Burgess
2016-04-11 12:55     ` Cupertino Miranda
2016-04-12 11:00   ` [PATCHv2 " Andrew Burgess
2016-04-13 13:37     ` Nick Clifton
2016-04-12 11:00   ` [PATCHv2 2/3] bfd/arc: Rename enum entries to avoid conflicts Andrew Burgess
2016-04-13 13:34     ` Nick Clifton
2016-04-12 11:00   ` [PATCHv2 1/3] opcodes/arc: Move instruction length logic to new function Andrew Burgess
2016-04-12 12:27     ` Claudiu Zissulescu
2016-04-13 13:32     ` Nick Clifton
2016-04-13 14:41       ` Andrew Burgess
2016-04-13 15:30         ` Nick Clifton
2016-04-14 12:40           ` Andrew Burgess
2016-04-14 14:45             ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460027127-1121-3-git-send-email-andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=Claudiu.Zissulescu@synopsys.com \
    --cc=Cupertino.Miranda@synopsys.com \
    --cc=binutils@sourceware.org \
    --cc=noamca@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).