Rename a bfd_link_hash_entry field
Alan Modra
amodra@bigpond.net.au
Tue Dec 2 23:01:00 GMT 2003
I was looking at places that use the undefined/common linked list the
other day, and the easiest way to find them all was to rename the field,
then compile. It's probably worth the bother of writing up a ChangeLog
and committing in case I or others want to grep for them at some point
in the future. "next" is just too common a name, and especially so when
we have h->next and h->root.next.
include/ChangeLog
* bfdlink.h (struct bfd_link_hash_entry): Rename "next" to "und_next".
bfd/ChangeLog
* ecoff.c (ecoff_link_add_archive_symbols): Update for renamed
bfd_link_hash_entry field "next" -> "und_next".
* linker.c (_bfd_link_hash_newfunc): Likewise.
(bfd_link_add_undef): Likewise.
(_bfd_generic_link_add_archive_symbols): Likewise.
(_bfd_generic_link_add_one_symbol): Likewise.
* xcofflink.c (xcoff_link_add_symbols): Likewise.
ld/ChangeLog
* emultempl/pe.em (pe_fixup_stdcalls): Update for renamed
bfd_link_hash_entry field "next" -> "und_next".
(pe_find_data_imports): Likewise.
(gld_${EMULATION_NAME}_after_open): Likewise.
* emultempl/sunos.em (before_allocation): Likewise.
Index: include/bfdlink.h
===================================================================
RCS file: /cvs/src/src/include/bfdlink.h,v
retrieving revision 1.38
diff -u -p -r1.38 bfdlink.h
--- include/bfdlink.h 2 Dec 2003 05:58:36 -0000 1.38
+++ include/bfdlink.h 2 Dec 2003 10:31:43 -0000
@@ -81,6 +81,7 @@ struct bfd_link_hash_entry
{
/* Base hash table entry structure. */
struct bfd_hash_entry root;
+
/* Type of this entry. */
enum bfd_link_hash_type type;
@@ -102,7 +103,8 @@ struct bfd_link_hash_entry
symbol is undefined and becomes defined, this field will
automatically be non-NULL since the symbol will have been on the
undefined symbol list. */
- struct bfd_link_hash_entry *next;
+ struct bfd_link_hash_entry *und_next;
+
/* A union of information depending upon the type. */
union
{
Index: bfd/ecoff.c
===================================================================
RCS file: /cvs/src/src/bfd/ecoff.c,v
retrieving revision 1.31
diff -u -p -r1.31 ecoff.c
--- bfd/ecoff.c 30 Nov 2003 18:40:41 -0000 1.31
+++ bfd/ecoff.c 2 Dec 2003 10:31:10 -0000
@@ -3566,9 +3566,9 @@ ecoff_link_add_archive_symbols (abfd, in
entry if it is the tail, because that would lose any
entries we add to the list later on. */
if (*pundef != info->hash->undefs_tail)
- *pundef = (*pundef)->next;
+ *pundef = (*pundef)->und_next;
else
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3578,7 +3578,7 @@ ecoff_link_add_archive_symbols (abfd, in
other object format. */
if (h->type != bfd_link_hash_undefined)
{
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3590,7 +3590,7 @@ ecoff_link_add_archive_symbols (abfd, in
if (file_offset == 0)
{
/* Nothing in this slot. */
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3621,7 +3621,7 @@ ecoff_link_add_archive_symbols (abfd, in
if (! found)
{
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -3643,7 +3643,7 @@ ecoff_link_add_archive_symbols (abfd, in
if (! ecoff_link_add_object_symbols (element, info))
return FALSE;
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
}
return TRUE;
Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.33
diff -u -p -r1.33 linker.c
--- bfd/linker.c 31 Oct 2003 05:32:45 -0000 1.33
+++ bfd/linker.c 2 Dec 2003 10:31:13 -0000
@@ -455,7 +455,7 @@ _bfd_link_hash_newfunc (struct bfd_hash_
/* Initialize the local fields. */
h->type = bfd_link_hash_new;
- h->next = NULL;
+ h->und_next = NULL;
}
return entry;
@@ -614,9 +614,9 @@ void
bfd_link_add_undef (struct bfd_link_hash_table *table,
struct bfd_link_hash_entry *h)
{
- BFD_ASSERT (h->next == NULL);
+ BFD_ASSERT (h->und_next == NULL);
if (table->undefs_tail != NULL)
- table->undefs_tail->next = h;
+ table->undefs_tail->und_next = h;
if (table->undefs == NULL)
table->undefs = h;
table->undefs_tail = h;
@@ -988,9 +988,9 @@ _bfd_generic_link_add_archive_symbols
us to lose track of whether the symbol has been
referenced). */
if (*pundef != info->hash->undefs_tail)
- *pundef = (*pundef)->next;
+ *pundef = (*pundef)->und_next;
else
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
@@ -1013,7 +1013,7 @@ _bfd_generic_link_add_archive_symbols
}
if (arh == NULL)
{
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
continue;
}
}
@@ -1062,7 +1062,7 @@ _bfd_generic_link_add_archive_symbols
}
}
- pundef = &(*pundef)->next;
+ pundef = &(*pundef)->und_next;
}
archive_hash_table_free (&arsym_hash);
@@ -1692,8 +1692,8 @@ _bfd_generic_link_add_one_symbol (struct
case REF:
/* A reference to a defined symbol. */
- if (h->next == NULL && info->hash->undefs_tail != h)
- h->next = h;
+ if (h->und_next == NULL && info->hash->undefs_tail != h)
+ h->und_next = h;
break;
case BIG:
@@ -1879,8 +1879,8 @@ _bfd_generic_link_add_one_symbol (struct
case REFC:
/* A reference to an indirect symbol. */
- if (h->next == NULL && info->hash->undefs_tail != h)
- h->next = h;
+ if (h->und_next == NULL && info->hash->undefs_tail != h)
+ h->und_next = h;
h = h->u.i.link;
cycle = TRUE;
break;
@@ -1895,10 +1895,10 @@ _bfd_generic_link_add_one_symbol (struct
case CWARN:
/* Warn if this symbol has been referenced already,
otherwise add a warning. A symbol has been referenced if
- the next field is not NULL, or it is the tail of the
+ the und_next field is not NULL, or it is the tail of the
undefined symbol list. The REF case above helps to
ensure this. */
- if (h->next != NULL || info->hash->undefs_tail == h)
+ if (h->und_next != NULL || info->hash->undefs_tail == h)
{
if (! (*info->callbacks->warning) (info, string, h->root.string,
hash_entry_bfd (h), NULL, 0))
Index: bfd/xcofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/xcofflink.c,v
retrieving revision 1.32
diff -u -p -r1.32 xcofflink.c
--- bfd/xcofflink.c 30 Nov 2003 18:40:41 -0000 1.32
+++ bfd/xcofflink.c 2 Dec 2003 10:31:17 -0000
@@ -1827,7 +1827,7 @@ xcoff_link_add_symbols (abfd, info)
section = bfd_und_section_ptr;
value = 0;
}
- else if ((*sym_hash)->root.next != NULL
+ else if ((*sym_hash)->root.und_next != NULL
|| info->hash->undefs_tail == &(*sym_hash)->root)
{
/* This symbol has been referenced. In this
Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.83
diff -u -p -r1.83 pe.em
--- ld/emultempl/pe.em 4 Nov 2003 23:36:21 -0000 1.83
+++ ld/emultempl/pe.em 2 Dec 2003 10:31:44 -0000
@@ -767,7 +767,7 @@ pe_fixup_stdcalls (void)
if (pe_dll_extra_pe_debug)
printf ("%s\n", __FUNCTION__);
- for (undef = link_info.hash->undefs; undef; undef=undef->next)
+ for (undef = link_info.hash->undefs; undef; undef=undef->und_next)
if (undef->type == bfd_link_hash_undefined)
{
char* at = strchr (undef->root.string, '@');
@@ -859,7 +859,7 @@ pe_find_data_imports (void)
if (link_info.pei386_auto_import == 0)
return;
- for (undef = link_info.hash->undefs; undef; undef=undef->next)
+ for (undef = link_info.hash->undefs; undef; undef=undef->und_next)
{
if (undef->type == bfd_link_hash_undefined)
{
@@ -939,7 +939,7 @@ gld_${EMULATION_NAME}_after_open (void)
printf ("%s()\n", __FUNCTION__);
- for (sym = link_info.hash->undefs; sym; sym=sym->next)
+ for (sym = link_info.hash->undefs; sym; sym=sym->und_next)
printf ("-%s\n", sym->root.string);
bfd_hash_traverse (&link_info.hash->table, pr_sym, NULL);
Index: ld/emultempl/sunos.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/sunos.em,v
retrieving revision 1.14
diff -u -p -r1.14 sunos.em
--- ld/emultempl/sunos.em 27 Jun 2003 00:38:25 -0000 1.14
+++ ld/emultempl/sunos.em 2 Dec 2003 10:31:44 -0000
@@ -679,7 +679,7 @@ gld${EMULATION_NAME}_before_allocation (
{
struct bfd_link_hash_entry *h;
- for (h = link_info.hash->undefs; h != NULL; h = h->next)
+ for (h = link_info.hash->undefs; h != NULL; h = h->und_next)
{
if (h->type == bfd_link_hash_undefined
&& h->u.undef.abfd != NULL
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list