elfos.h (ASM_OUTPUT_SECTION_NAME): Use a hash table, not a list, to keep track of the sections.
* config/elfos.h (ASM_OUTPUT_SECTION_NAME): Use a hash table, not a list, to keep track of the sections. * tm.texi (ASM_OUTPUT_SECTION_NAME): Document the fact that the parameter provided will always be a canonical string. From-SVN: r37776
This commit is contained in:
parent
a4c9b97e26
commit
231db5f4ec
|
@ -1,3 +1,10 @@
|
||||||
|
2000-11-26 Mark Mitchell <mark@codesourcery.com>
|
||||||
|
|
||||||
|
* config/elfos.h (ASM_OUTPUT_SECTION_NAME): Use a hash table, not
|
||||||
|
a list, to keep track of the sections.
|
||||||
|
* tm.texi (ASM_OUTPUT_SECTION_NAME): Document the fact that the
|
||||||
|
parameter provided will always be a canonical string.
|
||||||
|
|
||||||
2000-11-26 Neil Booth <neilb@earthling.net>
|
2000-11-26 Neil Booth <neilb@earthling.net>
|
||||||
|
|
||||||
* cppmacro.c (cpp_scan_buffer_nooutput): Only scan the
|
* cppmacro.c (cpp_scan_buffer_nooutput): Only scan the
|
||||||
|
|
|
@ -421,20 +421,27 @@ dtors_section () \
|
||||||
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
|
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
static struct section_info \
|
static htab_t htab; \
|
||||||
|
\
|
||||||
|
struct section_info \
|
||||||
{ \
|
{ \
|
||||||
struct section_info *next; \
|
|
||||||
char *name; \
|
|
||||||
enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
|
enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
|
||||||
} *sections; \
|
}; \
|
||||||
|
\
|
||||||
struct section_info *s; \
|
struct section_info *s; \
|
||||||
const char *mode; \
|
const char *mode; \
|
||||||
enum sect_enum type; \
|
enum sect_enum type; \
|
||||||
\
|
PTR* slot; \
|
||||||
for (s = sections; s; s = s->next) \
|
\
|
||||||
if (!strcmp (NAME, s->name)) \
|
/* The names we put in the hashtable will always be the unique \
|
||||||
break; \
|
versions gived to us by the stringtable, so we can just use \
|
||||||
\
|
their addresses as the keys. */ \
|
||||||
|
if (!htab) \
|
||||||
|
htab = htab_create (31, \
|
||||||
|
htab_hash_pointer, \
|
||||||
|
htab_eq_pointer, \
|
||||||
|
NULL); \
|
||||||
|
\
|
||||||
if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
|
if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||||
type = SECT_EXEC, mode = "ax"; \
|
type = SECT_EXEC, mode = "ax"; \
|
||||||
else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
|
else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
|
||||||
|
@ -442,21 +449,23 @@ dtors_section () \
|
||||||
else \
|
else \
|
||||||
type = SECT_RW, mode = "aw"; \
|
type = SECT_RW, mode = "aw"; \
|
||||||
\
|
\
|
||||||
if (s == 0) \
|
\
|
||||||
{ \
|
/* See if we already have an entry for this section. */ \
|
||||||
|
slot = htab_find_slot (htab, NAME, INSERT); \
|
||||||
|
if (!*slot) \
|
||||||
|
{ \
|
||||||
s = (struct section_info *) xmalloc (sizeof (* s)); \
|
s = (struct section_info *) xmalloc (sizeof (* s)); \
|
||||||
s->name = xmalloc ((strlen (NAME) + 1) * sizeof (* NAME)); \
|
|
||||||
strcpy (s->name, NAME); \
|
|
||||||
s->type = type; \
|
s->type = type; \
|
||||||
s->next = sections; \
|
*slot = s; \
|
||||||
sections = s; \
|
|
||||||
fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", \
|
fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", \
|
||||||
NAME, mode); \
|
NAME, mode); \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
|
s = (struct section_info *) *slot; \
|
||||||
if (DECL && s->type != type) \
|
if (DECL && s->type != type) \
|
||||||
error_with_decl (DECL, "%s causes a section type conflict");\
|
error_with_decl (DECL, \
|
||||||
|
"%s causes a section type conflict"); \
|
||||||
\
|
\
|
||||||
fprintf (FILE, "\t.section\t%s\n", NAME); \
|
fprintf (FILE, "\t.section\t%s\n", NAME); \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -5439,8 +5439,11 @@ A C statement to output something to the assembler file to switch to section
|
||||||
@var{name} for object @var{decl} which is either a @code{FUNCTION_DECL}, a
|
@var{name} for object @var{decl} which is either a @code{FUNCTION_DECL}, a
|
||||||
@code{VAR_DECL} or @code{NULL_TREE}. @var{reloc}
|
@code{VAR_DECL} or @code{NULL_TREE}. @var{reloc}
|
||||||
indicates whether the initial value of @var{exp} requires link-time
|
indicates whether the initial value of @var{exp} requires link-time
|
||||||
relocations. Some target formats do not support
|
relocations. The string given by @var{name} will always be the
|
||||||
arbitrary sections. Do not define this macro in such cases.
|
canonical version stored in the global stringpool.
|
||||||
|
|
||||||
|
Some target formats do not support arbitrary sections. Do not define
|
||||||
|
this macro in such cases.
|
||||||
|
|
||||||
At present this macro is only used to support section attributes.
|
At present this macro is only used to support section attributes.
|
||||||
When this macro is undefined, section attributes are disabled.
|
When this macro is undefined, section attributes are disabled.
|
||||||
|
|
Loading…
Reference in New Issue