diff options
-rw-r--r-- | gas/ChangeLog | 11 | ||||
-rw-r--r-- | gas/config/obj-elf.c | 19 | ||||
-rw-r--r-- | gas/symbols.c | 39 | ||||
-rw-r--r-- | gas/symbols.h | 17 |
4 files changed, 61 insertions, 25 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 44d3304..eee61f5 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +2002-06-07 Alan Modra <amodra@bigpond.net.au> + + * 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. + Thu Jun 6 17:42:12 2002 J"orn Rennecke <joern.rennecke@superh.com> * config/tc-sh.c (parse_at): @(symbol,pc) is A_DISP_PC again, 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); diff --git a/gas/symbols.c b/gas/symbols.c index d86c52a..58d0c07 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1,6 +1,6 @@ /* symbols.c -symbol table- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001 + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -569,7 +569,7 @@ symbol_find_or_make (name) symbolS * symbol_make (name) - CONST char *name; + const char *name; { symbolS *symbolP; @@ -589,7 +589,7 @@ symbol_make (name) symbolS * symbol_find (name) - CONST char *name; + const char *name; { #ifdef STRIP_UNDERSCORE return (symbol_find_base (name, 1)); @@ -599,8 +599,25 @@ symbol_find (name) } symbolS * +symbol_find_exact (name) + const char *name; +{ +#ifdef BFD_ASSEMBLER + { + struct local_symbol *locsym; + + locsym = (struct local_symbol *) hash_find (local_hash, name); + if (locsym != NULL) + return (symbolS *) locsym; + } +#endif + + return ((symbolS *) hash_find (sy_hash, name)); +} + +symbolS * symbol_find_base (name, strip_underscore) - CONST char *name; + const char *name; int strip_underscore; { if (strip_underscore && *name == '_') @@ -633,17 +650,7 @@ symbol_find_base (name, strip_underscore) *copy = '\0'; } -#ifdef BFD_ASSEMBLER - { - struct local_symbol *locsym; - - locsym = (struct local_symbol *) hash_find (local_hash, name); - if (locsym != NULL) - return (symbolS *) locsym; - } -#endif - - return ((symbolS *) hash_find (sy_hash, name)); + return symbol_find_exact (name); } /* Once upon a time, symbols were kept in a singly linked list. At @@ -1816,7 +1823,7 @@ S_IS_STABD (s) return S_GET_NAME (s) == 0; } -CONST char * +const char * S_GET_NAME (s) symbolS *s; { diff --git a/gas/symbols.h b/gas/symbols.h index a80ca8c..2fb0439 100644 --- a/gas/symbols.h +++ b/gas/symbols.h @@ -1,6 +1,6 @@ /* symbols.h - - Copyright 1987, 1990, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1987, 1990, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, + 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -48,13 +48,14 @@ extern int symbol_table_frozen; extern int symbols_case_sensitive; char *decode_local_label_name PARAMS ((char *s)); -symbolS *symbol_find PARAMS ((CONST char *name)); -symbolS *symbol_find_base PARAMS ((CONST char *name, int strip_underscore)); +symbolS *symbol_find PARAMS ((const char *name)); +symbolS *symbol_find_exact PARAMS ((const char *name)); +symbolS *symbol_find_base PARAMS ((const char *name, int strip_underscore)); symbolS *symbol_find_or_make PARAMS ((const char *name)); -symbolS *symbol_make PARAMS ((CONST char *name)); -symbolS *symbol_new PARAMS ((CONST char *name, segT segment, valueT value, +symbolS *symbol_make PARAMS ((const char *name)); +symbolS *symbol_new PARAMS ((const char *name, segT segment, valueT value, fragS * frag)); -symbolS *symbol_create PARAMS ((CONST char *name, segT segment, valueT value, +symbolS *symbol_create PARAMS ((const char *name, segT segment, valueT value, fragS * frag)); symbolS *colon PARAMS ((const char *sym_name)); void local_colon PARAMS ((int n)); @@ -93,7 +94,7 @@ extern int S_IS_DEBUG PARAMS ((symbolS *)); extern int S_IS_LOCAL PARAMS ((symbolS *)); extern int S_IS_EXTERN PARAMS ((symbolS *)); extern int S_IS_STABD PARAMS ((symbolS *)); -extern CONST char *S_GET_NAME PARAMS ((symbolS *)); +extern const char *S_GET_NAME PARAMS ((symbolS *)); extern segT S_GET_SEGMENT PARAMS ((symbolS *)); extern void S_SET_SEGMENT PARAMS ((symbolS *, segT)); extern void S_SET_EXTERNAL PARAMS ((symbolS *)); |