aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-elf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-06-07 14:57:50 +0000
committerAlan Modra <amodra@gmail.com>2002-06-07 14:57:50 +0000
commit9758f3fc77f7b9748293b7e265d362ceaddfdfb4 (patch)
tree69aaac4950cc56b6cec7d9d2b7c04def95eb7eb6 /gas/config/obj-elf.c
parent1126897b369207e6242a9e0f5bbee00c10831ded (diff)
downloadgdb-9758f3fc77f7b9748293b7e265d362ceaddfdfb4.zip
gdb-9758f3fc77f7b9748293b7e265d362ceaddfdfb4.tar.gz
gdb-9758f3fc77f7b9748293b7e265d362ceaddfdfb4.tar.bz2
* symbols.c: Replace CONST by const throughout.
(symbol_find_exact): Split out from.. (symbol_find_base): ..here. * symbols.h: Replace CONST by const throughout. (symbol_find_exact): Declare. * config/obj-elf.c: #include "struc-symbol.h". (elf_frob_file): If group name matches an exported symbol, use that symbol for the signature and ".group" as the section name.
Diffstat (limited to 'gas/config/obj-elf.c')
-rw-r--r--gas/config/obj-elf.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index ea8bd4d..2266952 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -24,6 +24,7 @@
#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
+#include "struc-symbol.h"
#ifndef ECOFF_DEBUGGING
#define ECOFF_DEBUGGING 0
@@ -2024,8 +2025,11 @@ elf_frob_file ()
for (i = 0; i < list.num_group; i++)
{
const char *group_name = elf_group_name (list.head[i]);
+ const char *sec_name;
asection *s;
flagword flags;
+ struct symbol *sy;
+ int has_sym;
flags = SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_GROUP;
for (s = list.head[i]; s != NULL; s = elf_next_in_group (s))
@@ -2040,7 +2044,18 @@ elf_frob_file ()
}
}
- s = subseg_force_new (group_name, 0);
+ sec_name = group_name;
+ sy = symbol_find_exact (group_name);
+ has_sym = 0;
+ if (sy != NULL
+ && (sy == symbol_lastP
+ || (sy->sy_next != NULL
+ && sy->sy_next->sy_previous == sy)))
+ {
+ has_sym = 1;
+ sec_name = ".group";
+ }
+ s = subseg_force_new (sec_name, 0);
if (s == NULL
|| !bfd_set_section_flags (stdoutput, s, flags)
|| !bfd_set_section_alignment (stdoutput, s, 2))
@@ -2051,6 +2066,8 @@ elf_frob_file ()
/* Pass a pointer to the first section in this group. */
elf_next_in_group (s) = list.head[i];
+ if (has_sym)
+ elf_group_id (s) = sy->bsym;
s->_raw_size = 4 * (list.elt_count[i] + 1);
s->contents = frag_more (s->_raw_size);