bfd/arc: Rename enum entries to avoid conflicts
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 6 Apr 2016 17:55:23 +0000 (18:55 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 14 Apr 2016 16:15:42 +0000 (17:15 +0100)
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
bfd/elf32-arc.c

index ac8e8c820b927a0b616490b47c79b9ee8acc16d4..3d0469005f0280ca89c437e177c03d07356c1468 100644 (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
index 323f65d0bbec6e4c322103b339c148c897c1b882..d67e88ca743a441e5ea8920f4c8dd1abfbf57d35 100644 (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),
This page took 0.031447 seconds and 4 git commands to generate.