aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2006-06-09 01:13:39 +0000
committerAlan Modra <amodra@gmail.com>2006-06-09 01:13:39 +0000
commit409d7240c75181b16af5a78b2aa1aef71003a025 (patch)
tree7272d44e9c82602fb49b2e646882705c6c244255 /ld/ldlang.c
parent2b949cb6bbbb2e8a968026c0a0dfe378e7d1bfa5 (diff)
downloadgdb-409d7240c75181b16af5a78b2aa1aef71003a025.zip
gdb-409d7240c75181b16af5a78b2aa1aef71003a025.tar.gz
gdb-409d7240c75181b16af5a78b2aa1aef71003a025.tar.bz2
* ldlang.h (lang_input_statement_type): Use bitfields for booleans.
* ldlang.c (struct out_section_hash_entry): Rename from output_statement_hash_entry. Delete output_section_statement_type entry. Add statement_union_type entry. Adjust all users. (output_section_statement_table): Rename from output_statement_table. Adjust all users. (output_section_statement_newfunc): Rename from output_statement_newfunc. Adjust all users. (output_section_statement_table_init): Rename from output_statement_table_init. Adjust all users. (output_section_statement_table_free): Rename from output_statement_table_free. Adjust all users.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c108
1 files changed, 56 insertions, 52 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 9c9f965..a9af491 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -869,26 +869,26 @@ lang_add_input_file (const char *name,
return new_afile (name, file_type, target, TRUE);
}
-struct output_statement_hash_entry
+struct out_section_hash_entry
{
struct bfd_hash_entry root;
- lang_output_section_statement_type os;
+ lang_statement_union_type s;
};
/* The hash table. */
-static struct bfd_hash_table output_statement_table;
+static struct bfd_hash_table output_section_statement_table;
/* Support routines for the hash table used by lang_output_section_find,
initialize the table, fill in an entry and remove the table. */
static struct bfd_hash_entry *
-output_statement_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
+output_section_statement_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
lang_output_section_statement_type **nextp;
- struct output_statement_hash_entry *ret;
+ struct out_section_hash_entry *ret;
if (entry == NULL)
{
@@ -901,49 +901,48 @@ output_statement_newfunc (struct bfd_hash_entry *entry,
if (entry == NULL)
return entry;
- ret = (struct output_statement_hash_entry *) entry;
- memset (&ret->os, 0, sizeof (ret->os));
- ret->os.header.type = lang_output_section_statement_enum;
- ret->os.subsection_alignment = -1;
- ret->os.section_alignment = -1;
- ret->os.block_value = 1;
- lang_list_init (&ret->os.children);
- lang_statement_append (stat_ptr,
- (lang_statement_union_type *) &ret->os,
- &ret->os.header.next);
+ ret = (struct out_section_hash_entry *) entry;
+ memset (&ret->s, 0, sizeof (ret->s));
+ ret->s.header.type = lang_output_section_statement_enum;
+ ret->s.output_section_statement.subsection_alignment = -1;
+ ret->s.output_section_statement.section_alignment = -1;
+ ret->s.output_section_statement.block_value = 1;
+ lang_list_init (&ret->s.output_section_statement.children);
+ lang_statement_append (stat_ptr, &ret->s, &ret->s.header.next);
/* For every output section statement added to the list, except the
first one, lang_output_section_statement.tail points to the "next"
field of the last element of the list. */
if (lang_output_section_statement.head != NULL)
- ret->os.prev = (lang_output_section_statement_type *)
- ((char *) lang_output_section_statement.tail
- - offsetof (lang_output_section_statement_type, next));
+ ret->s.output_section_statement.prev
+ = ((lang_output_section_statement_type *)
+ ((char *) lang_output_section_statement.tail
+ - offsetof (lang_output_section_statement_type, next)));
/* GCC's strict aliasing rules prevent us from just casting the
address, so we store the pointer in a variable and cast that
instead. */
- nextp = &ret->os.next;
+ nextp = &ret->s.output_section_statement.next;
lang_statement_append (&lang_output_section_statement,
- (lang_statement_union_type *) &ret->os,
+ &ret->s,
(lang_statement_union_type **) nextp);
return &ret->root;
}
static void
-output_statement_table_init (void)
+output_section_statement_table_init (void)
{
- if (!bfd_hash_table_init_n (&output_statement_table,
- output_statement_newfunc,
- sizeof (struct output_statement_hash_entry),
+ if (!bfd_hash_table_init_n (&output_section_statement_table,
+ output_section_statement_newfunc,
+ sizeof (struct out_section_hash_entry),
61))
einfo (_("%P%F: can not create hash table: %E\n"));
}
static void
-output_statement_table_free (void)
+output_section_statement_table_free (void)
{
- bfd_hash_table_free (&output_statement_table);
+ bfd_hash_table_free (&output_section_statement_table);
}
/* Build enough state so that the parser can build its tree. */
@@ -955,7 +954,7 @@ lang_init (void)
stat_ptr = &statement_list;
- output_statement_table_init ();
+ output_section_statement_table_init ();
lang_list_init (stat_ptr);
@@ -985,7 +984,7 @@ lang_init (void)
void
lang_finish (void)
{
- output_statement_table_free ();
+ output_section_statement_table_free ();
}
/*----------------------------------------------------------------------
@@ -1072,24 +1071,25 @@ lang_memory_default (asection *section)
lang_output_section_statement_type *
lang_output_section_find (const char *const name)
{
- struct output_statement_hash_entry *entry;
+ struct out_section_hash_entry *entry;
unsigned long hash;
- entry = ((struct output_statement_hash_entry *)
- bfd_hash_lookup (&output_statement_table, name, FALSE, FALSE));
+ entry = ((struct out_section_hash_entry *)
+ bfd_hash_lookup (&output_section_statement_table, name,
+ FALSE, FALSE));
if (entry == NULL)
return NULL;
hash = entry->root.hash;
do
{
- if (entry->os.constraint != -1)
- return &entry->os;
- entry = (struct output_statement_hash_entry *) entry->root.next;
+ if (entry->s.output_section_statement.constraint != -1)
+ return &entry->s.output_section_statement;
+ entry = (struct out_section_hash_entry *) entry->root.next;
}
while (entry != NULL
&& entry->root.hash == hash
- && strcmp (name, entry->os.name) == 0);
+ && strcmp (name, entry->s.output_section_statement.name) == 0);
return NULL;
}
@@ -1097,39 +1097,43 @@ lang_output_section_find (const char *const name)
static lang_output_section_statement_type *
lang_output_section_statement_lookup_1 (const char *const name, int constraint)
{
- struct output_statement_hash_entry *entry;
- struct output_statement_hash_entry *last_ent;
+ struct out_section_hash_entry *entry;
+ struct out_section_hash_entry *last_ent;
unsigned long hash;
- entry = ((struct output_statement_hash_entry *)
- bfd_hash_lookup (&output_statement_table, name, TRUE, FALSE));
+ entry = ((struct out_section_hash_entry *)
+ bfd_hash_lookup (&output_section_statement_table, name,
+ TRUE, FALSE));
if (entry == NULL)
{
einfo (_("%P%F: failed creating section `%s': %E\n"), name);
return NULL;
}
- if (entry->os.name != NULL)
+ if (entry->s.output_section_statement.name != NULL)
{
/* We have a section of this name, but it might not have the correct
constraint. */
hash = entry->root.hash;
do
{
- if (entry->os.constraint != -1
+ if (entry->s.output_section_statement.constraint != -1
&& (constraint == 0
- || (constraint == entry->os.constraint
+ || (constraint == entry->s.output_section_statement.constraint
&& constraint != SPECIAL)))
- return &entry->os;
+ return &entry->s.output_section_statement;
last_ent = entry;
- entry = (struct output_statement_hash_entry *) entry->root.next;
+ entry = (struct out_section_hash_entry *) entry->root.next;
}
while (entry != NULL
&& entry->root.hash == hash
- && strcmp (name, entry->os.name) == 0);
+ && strcmp (name, entry->s.output_section_statement.name) == 0);
- entry = ((struct output_statement_hash_entry *)
- output_statement_newfunc (NULL, &output_statement_table, name));
+ entry
+ = ((struct out_section_hash_entry *)
+ output_section_statement_newfunc (NULL,
+ &output_section_statement_table,
+ name));
if (entry == NULL)
{
einfo (_("%P%F: failed creating section `%s': %E\n"), name);
@@ -1139,9 +1143,9 @@ lang_output_section_statement_lookup_1 (const char *const name, int constraint)
last_ent->root.next = &entry->root;
}
- entry->os.name = name;
- entry->os.constraint = constraint;
- return &entry->os;
+ entry->s.output_section_statement.name = name;
+ entry->s.output_section_statement.constraint = constraint;
+ return &entry->s.output_section_statement;
}
lang_output_section_statement_type *