Commit 01fa3508 by Jeffrey A Law Committed by Jeff Law

pa-64.h (ASM_OUTPUT_SECTION_NAME): Use a hash table, not a list, to keep track of the sections.

	* pa/pa-64.h (ASM_OUTPUT_SECTION_NAME): Use a hash table, not
	a list, to keep track of the sections.

From-SVN: r37843
parent 5662d533
Tue Nov 28 21:56:45 2000 Jeffrey A Law (law@cygnus.com)
* pa/pa-64.h (ASM_OUTPUT_SECTION_NAME): Use a hash table, not
a list, to keep track of the sections.
2000-11-28 Nick Clifton <nickc@redhat.com> 2000-11-28 Nick Clifton <nickc@redhat.com>
* config/arm/arm.md (pic_load_addr): Split into * config/arm/arm.md (pic_load_addr): Split into
......
...@@ -273,46 +273,58 @@ dtors_section () \ ...@@ -273,46 +273,58 @@ dtors_section () \
If DECL is NULL, no attributes are emitted. */ If DECL is NULL, no attributes are emitted. */
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \ #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
do { \ do \
static struct section_info \
{ \ { \
struct section_info *next; \ static htab_t htab; \
char *name; \ \
enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \ struct section_info \
} *sections; \ { \
struct section_info *s; \ enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
char *mode; \ }; \
enum sect_enum type; \ \
\ struct section_info *s; \
for (s = sections; s; s = s->next) \ const char *mode; \
if (!strcmp (NAME, s->name)) \ enum sect_enum type; \
break; \ PTR* slot; \
\ \
if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \ /* The names we put in the hashtable will always be the unique \
type = SECT_EXEC, mode = "ax"; \ versions gived to us by the stringtable, so we can just use \
else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \ their addresses as the keys. */ \
type = SECT_RO, mode = "a"; \ if (!htab) \
else \ htab = htab_create (31, \
type = SECT_RW, mode = "aw"; \ htab_hash_pointer, \
\ htab_eq_pointer, \
if (s == 0) \ NULL); \
{ \ \
s = (struct section_info *) xmalloc (sizeof (struct section_info)); \ if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \ type = SECT_EXEC, mode = "ax"; \
strcpy (s->name, NAME); \ else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
s->type = type; \ type = SECT_RO, mode = "a"; \
s->next = sections; \ else \
sections = s; \ type = SECT_RW, mode = "aw"; \
fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", NAME, mode); \ \
} \ \
else \ /* See if we already have an entry for this section. */ \
{ \ slot = htab_find_slot (htab, NAME, INSERT); \
if (DECL && s->type != type) \ if (!*slot) \
error_with_decl (DECL, "%s causes a section type conflict"); \ { \
\ s = (struct section_info *) xmalloc (sizeof (* s)); \
fprintf (FILE, "\t.section\t%s\n", NAME); \ s->type = type; \
*slot = s; \
fprintf (FILE, "\t.section\t%s,\"%s\",@progbits\n", \
NAME, mode); \
} \
else \
{ \
s = (struct section_info *) *slot; \
if (DECL && s->type != type) \
error_with_decl (DECL, \
"%s causes a section type conflict"); \
\
fprintf (FILE, "\t.section\t%s\n", NAME); \
} \
} \ } \
} while (0) while (0)
#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
#define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL)) #define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment