/* elfos.h -- operating system specific defines to be used when
targeting GCC for some generic ELF system
- Copyright (C) 1991, 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994, 1995, 1999, 2000, 2001
+ Free Software Foundation, Inc.
Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com).
This file is part of GNU CC.
#define IDENT_ASM_OP "\t.ident\t"
+#undef ASM_FILE_END
#define ASM_FILE_END(FILE) \
do \
{ \
} \
while (0)
-/* This is the pseudo-op used to generate a 32-bit word of data with a
- specific value in some section. This is the same for all known svr4
- assemblers. */
+/* This is the pseudo-op used to generate a reference to a specific
+ symbol in some section. It is only used in machine-specific
+ configuration files, typically only in ASM_OUTPUT_CONSTRUCTOR and
+ ASM_OUTPUT_DESTRUCTOR. This is the same for all known svr4
+ assemblers, except those in targets that don't use 32-bit pointers.
+ Those should override INT_ASM_OP. Yes, the name of the macro is
+ misleading. */
+#ifndef INT_ASM_OP
#define INT_ASM_OP "\t.long\t"
+#endif
/* This is the pseudo-op used to generate a contiguous sequence of byte
values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
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; \
- } *sections; \
+ }; \
+ \
struct section_info *s; \
const char *mode; \
- enum sect_enum type; \
- \
- for (s = sections; s; s = s->next) \
- if (!strcmp (NAME, s->name)) \
- break; \
- \
+ enum sect_enum type; \
+ PTR* slot; \
+ \
+ /* The names we put in the hashtable will always be the unique \
+ 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) \
type = SECT_EXEC, mode = "ax"; \
else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
else \
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->name = xmalloc ((strlen (NAME) + 1) * sizeof (* NAME)); \
- strcpy (s->name, NAME); \
s->type = type; \
- s->next = sections; \
- sections = s; \
+ *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");\
+ error_with_decl (DECL, \
+ "%s causes a section type conflict"); \
\
fprintf (FILE, "\t.section\t%s\n", NAME); \
} \