aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMumit Khan <khan@xraylith.wisc.edu>1998-08-29 08:01:47 -0600
committerJeff Law <law@gcc.gnu.org>1998-08-29 08:01:47 -0600
commita1612a6c5f78d5ae93e6abdca7f09bf8daa939bc (patch)
tree5ffcf0f8048a60bcf9059d1bdd6f3adda2005b72 /gcc
parent9c79f69ef974ec2446e3c2f225b83b3ed65d1689 (diff)
downloadgcc-a1612a6c5f78d5ae93e6abdca7f09bf8daa939bc.zip
gcc-a1612a6c5f78d5ae93e6abdca7f09bf8daa939bc.tar.gz
gcc-a1612a6c5f78d5ae93e6abdca7f09bf8daa939bc.tar.bz2
cygwin32.h (ASM_OUTPUT_SECTION_NAME): Don't emit .linkonce directive after the first time.
0 * i386/cygwin32.h (ASM_OUTPUT_SECTION_NAME): Don't emit .linkonce directive after the first time. From-SVN: r22086
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/i386/cygwin32.h62
1 files changed, 47 insertions, 15 deletions
diff --git a/gcc/config/i386/cygwin32.h b/gcc/config/i386/cygwin32.h
index cc5ff45..76f2b9b 100644
--- a/gcc/config/i386/cygwin32.h
+++ b/gcc/config/i386/cygwin32.h
@@ -335,21 +335,53 @@ extern void i386_pe_unique_section ();
NULL_TREE. Some target formats do not support arbitrary sections. Do not
define this macro in such cases. */
#undef ASM_OUTPUT_SECTION_NAME
-#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
-do { \
- if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \
- fprintf (STREAM, "\t.section %s,\"x\"\n", (NAME)); \
- else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \
- fprintf (STREAM, "\t.section %s,\"\"\n", (NAME)); \
- else \
- fprintf (STREAM, "\t.section %s,\"w\"\n", (NAME)); \
- /* Functions may have been compiled at various levels of \
- optimization so we can't use `same_size' here. Instead, \
- have the linker pick one. */ \
- if ((DECL) && DECL_ONE_ONLY (DECL)) \
- fprintf (STREAM, "\t.linkonce %s\n", \
- TREE_CODE (DECL) == FUNCTION_DECL \
- ? "discard" : "same_size"); \
+#define ASM_OUTPUT_SECTION_NAME(STREAM, DECL, NAME, RELOC) \
+do { \
+ static struct section_info \
+ { \
+ struct section_info *next; \
+ char *name; \
+ enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type; \
+ } *sections; \
+ struct section_info *s; \
+ char *mode; \
+ enum sect_enum type; \
+ \
+ for (s = sections; s; s = s->next) \
+ if (!strcmp (NAME, s->name)) \
+ break; \
+ \
+ if (DECL && TREE_CODE (DECL) == FUNCTION_DECL) \
+ type = SECT_EXEC, mode = "x"; \
+ else if (DECL && DECL_READONLY_SECTION (DECL, RELOC)) \
+ type = SECT_RO, mode = ""; \
+ else \
+ type = SECT_RW, mode = "w"; \
+ \
+ if (s == 0) \
+ { \
+ s = (struct section_info *) xmalloc (sizeof (struct section_info)); \
+ s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME)); \
+ strcpy (s->name, NAME); \
+ s->type = type; \
+ s->next = sections; \
+ sections = s; \
+ fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
+ /* Functions may have been compiled at various levels of \
+ optimization so we can't use `same_size' here. Instead, \
+ have the linker pick one. */ \
+ if ((DECL) && DECL_ONE_ONLY (DECL)) \
+ fprintf (STREAM, "\t.linkonce %s\n", \
+ TREE_CODE (DECL) == FUNCTION_DECL \
+ ? "discard" : "same_size"); \
+ } \
+ else \
+ { \
+ if (DECL && s->type != type) \
+ error_with_decl (DECL, "%s causes a section type conflict"); \
+ \
+ fprintf (STREAM, ".section\t%s,\"%s\"\n", NAME, mode); \
+ } \
} while (0)
/* Write the extra assembler code needed to declare a function