diff options
Diffstat (limited to 'gcc/config/i386/winnt.c')
-rw-r--r-- | gcc/config/i386/winnt.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index f1a2d4b83be..24d8617f8df 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)); + } } + |