aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMumit Khan <khan@xraylith.wisc.edu>1999-06-21 04:52:50 +0000
committerJeff Law <law@gcc.gnu.org>1999-06-20 22:52:50 -0600
commite43f9c109233942564450ca5d736995a584b3160 (patch)
tree5db0fed3f3e55665a956f15a9b1959900a0d001e
parent6000b42b218b075fe08b1cb9c6c7e43d595e6ac9 (diff)
downloadgcc-e43f9c109233942564450ca5d736995a584b3160.zip
gcc-e43f9c109233942564450ca5d736995a584b3160.tar.gz
gcc-e43f9c109233942564450ca5d736995a584b3160.tar.bz2
winnt.c (exports_head): New static variable.
* i386/winnt.c (exports_head): New static variable. (i386_pe_record_exported_symbol): New function. (i386_pe_asm_file_end): Use. * i386/cygwin.h (ASM_OUTPUT_COMMON): Record the exported symbols to be emitted at end of assembly. (ASM_DECLARE_OBJECT_NAME): Likewise. (ASM_DECLARE_FUNCTION_NAME): Likewise. From-SVN: r27639
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/i386/cygwin.h22
-rw-r--r--gcc/config/i386/winnt.c32
3 files changed, 43 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cccdf46..e0f21f7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
Mon Jun 21 05:33:15 1999 Mumit Khan <khan@xraylith.wisc.edu>
+ * i386/winnt.c (exports_head): New static variable.
+ (i386_pe_record_exported_symbol): New function.
+ (i386_pe_asm_file_end): Use.
+ * i386/cygwin.h (ASM_OUTPUT_COMMON): Record the exported
+ symbols to be emitted at end of assembly.
+ (ASM_DECLARE_OBJECT_NAME): Likewise.
+ (ASM_DECLARE_FUNCTION_NAME): Likewise.
+
* i386/uwin.h (CPP_SPEC): Use -idirafter instead -iprefix and
-iwithprefix.
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 0b6a70f..dbea466 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -326,11 +326,7 @@ do { \
#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
do { \
if (i386_pe_dllexport_name_p (NAME)) \
- { \
- drectve_section (); \
- fprintf ((STREAM), "\t.ascii \" -export:%s\"\n", \
- I386_PE_STRIP_ENCODING (NAME)); \
- } \
+ i386_pe_record_exported_symbol (NAME); \
if (! i386_pe_dllimport_name_p (NAME)) \
{ \
fprintf ((STREAM), "\t.comm\t"); \
@@ -345,13 +341,7 @@ do { \
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
do { \
if (i386_pe_dllexport_name_p (NAME)) \
- { \
- enum in_section save_section = in_section; \
- drectve_section (); \
- fprintf ((STREAM), "\t.ascii \" -export:%s\"\n", \
- I386_PE_STRIP_ENCODING (NAME)); \
- switch_to_section (save_section, (DECL)); \
- } \
+ i386_pe_record_exported_symbol (NAME); \
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
} while (0)
@@ -447,12 +437,7 @@ do { \
do \
{ \
if (i386_pe_dllexport_name_p (NAME)) \
- { \
- drectve_section (); \
- fprintf ((FILE), "\t.ascii \" -export:%s\"\n", \
- I386_PE_STRIP_ENCODING (NAME)); \
- function_section (DECL); \
- } \
+ i386_pe_record_exported_symbol (NAME); \
if (write_symbols != SDB_DEBUG) \
i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
ASM_OUTPUT_LABEL (FILE, NAME); \
@@ -518,6 +503,7 @@ do { \
extern void i386_pe_record_external_function PROTO((char *));
extern void i386_pe_declare_function_type STDIO_PROTO((FILE *, char *, int));
+extern void i386_pe_record_exported_symbol PROTO((char *));
extern void i386_pe_asm_file_end STDIO_PROTO((FILE *));
/* For Win32 ABI compatibility */
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index f1a2d4b..24d8617 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -545,8 +545,29 @@ i386_pe_record_external_function (name)
extern_head = p;
}
+static struct extern_list *exports_head;
+
+/* Assemble an export symbol entry. We need to keep a list of
+ these, so that we can output the export list at the end of the
+ assembly. We used to output these export symbols in each function,
+ but that causes problems with GNU ld when the sections are
+ linkonce. */
+
+void
+i386_pe_record_exported_symbol (name)
+ char *name;
+{
+ struct extern_list *p;
+
+ p = (struct extern_list *) permalloc (sizeof *p);
+ p->next = exports_head;
+ p->name = name;
+ exports_head = p;
+}
+
/* This is called at the end of assembly. For each external function
- which has not been defined, we output a declaration now. */
+ which has not been defined, we output a declaration now. We also
+ output the .drectve section. */
void
i386_pe_asm_file_end (file)
@@ -567,4 +588,13 @@ i386_pe_asm_file_end (file)
i386_pe_declare_function_type (file, p->name, TREE_PUBLIC (decl));
}
}
+
+ if (exports_head)
+ drectve_section ();
+ for (p = exports_head; p != NULL; p = p->next)
+ {
+ fprintf (file, "\t.ascii \" -export:%s\"\n",
+ I386_PE_STRIP_ENCODING (p->name));
+ }
}
+