aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-ecoff.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-01-05 13:13:18 +0000
committerAlan Modra <amodra@gmail.com>2002-01-05 13:13:18 +0000
commit7c6beb69886dccfb3cd3efbb5e966683936f6eac (patch)
tree279bef92a9471f76cee4b5b32f2425bfd1531ec6 /gas/config/obj-ecoff.c
parent9e7b37b31f29ad3b8321d15e589ed5de550c56d3 (diff)
downloadgdb-7c6beb69886dccfb3cd3efbb5e966683936f6eac.zip
gdb-7c6beb69886dccfb3cd3efbb5e966683936f6eac.tar.gz
gdb-7c6beb69886dccfb3cd3efbb5e966683936f6eac.tar.bz2
* write.c (write_object_file): Make use of bfd_section_list_remove.
* config/obj-ecoff.c (ecoff_frob_file): Likewise. * config/tc-mmix.c (mmix_frob_file): Likewise.
Diffstat (limited to 'gas/config/obj-ecoff.c')
-rw-r--r--gas/config/obj-ecoff.c72
1 files changed, 29 insertions, 43 deletions
diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c
index d1eabce..4d055cb 100644
--- a/gas/config/obj-ecoff.c
+++ b/gas/config/obj-ecoff.c
@@ -106,7 +106,7 @@ ecoff_frob_file ()
const struct ecoff_debug_swap * const debug_swap
= &ecoff_backend (stdoutput)->debug_swap;
bfd_vma addr;
- asection *sec;
+ asection **sec;
HDRR *hdr;
char *buf;
char *set;
@@ -143,53 +143,39 @@ ecoff_frob_file ()
};
#define n_names ((int) (sizeof (names) / sizeof (names[0])))
+ /* Sections that match names, order to be straightened out later. */
+ asection *secs[n_names];
+ int i;
+
addr = 0;
- {
- /* Sections that match names, order to be straightened out later. */
- asection *secs[n_names];
- /* Linked list of sections with non-matching names. Random ordering. */
- asection *other_sections = 0;
- /* Pointer to next section, since we're destroying the original
- ordering. */
- asection *next;
-
- int i;
-
- for (i = 0; i < n_names; i++)
- secs[i] = 0;
- for (sec = stdoutput->sections; sec != (asection *) NULL; sec = next)
- {
- next = sec->next;
- for (i = 0; i < n_names; i++)
- if (!strcmp (sec->name, names[i]))
- {
- secs[i] = sec;
- break;
- }
- if (i == n_names)
+ for (i = 0; i < n_names; i++)
+ secs[i] = 0;
+
+ for (sec = &stdoutput->sections; *sec != (asection *) NULL; )
+ {
+ for (i = 0; i < n_names; i++)
+ if (!strcmp ((*sec)->name, names[i]))
{
- bfd_set_section_vma (stdoutput, sec, addr);
- addr += bfd_section_size (stdoutput, sec);
- sec->next = other_sections;
- other_sections = sec;
+ secs[i] = *sec;
+ bfd_section_list_remove (stdoutput, sec);
+ break;
}
- }
- for (i = 0; i < n_names; i++)
- if (secs[i])
+ if (i == n_names)
{
- sec = secs[i];
- bfd_set_section_vma (stdoutput, sec, addr);
- addr += bfd_section_size (stdoutput, sec);
+ bfd_set_section_vma (stdoutput, *sec, addr);
+ addr += bfd_section_size (stdoutput, *sec);
+ sec = &(*sec)->next;
}
- for (i = n_names - 1; i >= 0; i--)
- if (secs[i])
- {
- sec = secs[i];
- sec->next = other_sections;
- other_sections = sec;
- }
- stdoutput->sections = other_sections;
- }
+ }
+ for (i = 0; i < n_names; i++)
+ if (secs[i])
+ {
+ bfd_set_section_vma (stdoutput, secs[i], addr);
+ addr += bfd_section_size (stdoutput, secs[i]);
+ }
+ for (i = n_names - 1; i >= 0; i--)
+ if (secs[i])
+ bfd_section_list_insert (stdoutput, &stdoutput->sections, secs[i]);
/* Build the ECOFF debugging information. */
assert (ecoff_data (stdoutput) != 0);