diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2011-04-18 15:40:27 +0000 |
---|---|---|
committer | Kai Tietz <kai.tietz@onevision.com> | 2011-04-18 15:40:27 +0000 |
commit | dc204beb8b37c1b6f7bf55e2155621ed97dcb563 (patch) | |
tree | a16e84ffc502782735fdde27f30a80e9dd8b1693 /ld | |
parent | bdca0ea17b5b2e51245031d324d276bba094f1fe (diff) | |
download | fsf-binutils-gdb-dc204beb8b37c1b6f7bf55e2155621ed97dcb563.zip fsf-binutils-gdb-dc204beb8b37c1b6f7bf55e2155621ed97dcb563.tar.gz fsf-binutils-gdb-dc204beb8b37c1b6f7bf55e2155621ed97dcb563.tar.bz2 |
2011-04-18 Kai Tietz <ktietz@redhat.com>
* deffilep.y (def_aligncomm): Avoid duplets.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 2 | ||||
-rw-r--r-- | ld/deffilep.y | 34 |
2 files changed, 32 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index d2db3fd..26164a9 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,7 @@ 2011-04-18 Kai Tietz <ktietz@redhat.com> + * deffilep.y (def_aligncomm): Avoid duplets. + * deffilep.y (def_pool_str): New type. (pool_strs): Local static. (def_pool_alloc): Local function. diff --git a/ld/deffilep.y b/ld/deffilep.y index c1c95d2..58f3dd2 100644 --- a/ld/deffilep.y +++ b/ld/deffilep.y @@ -1095,13 +1095,39 @@ def_directive (char *str) static void def_aligncomm (char *str, int align) { - def_file_aligncomm *c = xmalloc (sizeof (def_file_aligncomm)); + def_file_aligncomm *c, *p; + + p = NULL; + c = def->aligncomms; + while (c != NULL) + { + int e = strcmp (c->symbol_name, str); + if (!e) + { + /* Not sure if we want to allow here duplicates with + different alignments, but for now we keep them. */ + e = (int) c->alignment - align; + if (!e) + return; + } + if (e > 0) + break; + c = (p = c)->next; + } + c = xmalloc (sizeof (def_file_aligncomm)); c->symbol_name = xstrdup (str); c->alignment = (unsigned int) align; - - c->next = def->aligncomms; - def->aligncomms = c; + if (!p) + { + c->next = def->aligncomms; + def->aligncomms = c; + } + else + { + c->next = p->next; + p->next = c; + } } static int |