This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
(patch) pe-dll dup export warning + compat implib fix
- To: binutils at sourceware dot cygnus dot com
- Subject: (patch) pe-dll dup export warning + compat implib fix
- From: Mumit Khan <khan at nanotech dot wisc dot edu>
- Date: Mon, 03 Jan 2000 13:56:44 -0600
Two small tweaks to pe-dll code.
1. --warn-dup-exports quash the warning about duplicate exports; otherwise
you get tons of unnecessary warnings when building C++ DLLs, where
linkonce symbols are all over.
2. --compat-implib adds the double underscore __imp_<SYMBOL> to be
backward compatible for those using ancient versions of gcc. And I
mean really ancient! This takes down the size of one of my implibs
from 6.8MB to 5.9MB, a reasonable saving in my book. I'll send
a separate equiv patch for dlltool.
1999-12-23 Mumit Khan <khan@xraylith.wisc.edu>
* pe-dll.c (pe_dll_warn_dup_exports): New variable.
(process_def_file): Use.
(pe_dll_compat_implib): New variable.
(make_one): Use.
* emultempl/pe.em (longopts): Add warn-duplicate-exports and
compat-implib options.
(gld_${EMULATION_NAME}_list_options): List new options.
(gld_${EMULATION_NAME}_parse_args): Handle.
Index: pe-dll.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/binutils-19990911/ld/pe-dll.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 pe-dll.c
--- pe-dll.c 1999/12/23 07:54:11 1.3
+++ pe-dll.c 1999/12/23 09:58:57
@@ -59,6 +59,8 @@ int pe_dll_export_everything = 0;
int pe_dll_do_default_excludes = 1;
int pe_dll_kill_ats = 0;
int pe_dll_stdcall_aliases = 0;
+int pe_dll_warn_dup_exports = 0;
+int pe_dll_compat_implib = 0;
/************************************************************************
@@ -349,8 +351,9 @@ process_def_file (abfd, info)
else
{
/* xgettext:c-format */
- einfo (_("Warning, duplicate EXPORT: %s\n"),
- e[j - 1].name);
+ if (pe_dll_warn_dup_exports)
+ einfo (_("Warning, duplicate EXPORT: %s\n"),
+ e[j - 1].name);
}
if (e[i].ordinal)
e[j - 1].ordinal = e[i].ordinal;
@@ -1356,7 +1359,9 @@ make_one (exp, parent)
if (! exp->flag_data)
quick_symbol (abfd, U(""), exp->internal_name, "", tx, BSF_GLOBAL, 0);
quick_symbol (abfd, U("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0);
- quick_symbol (abfd, U("__imp_"), exp->internal_name, "", id5, BSF_GLOBAL, 0);
+ if (pe_dll_compat_implib)
+ quick_symbol (abfd, U("__imp_"), exp->internal_name, "",
+ id5, BSF_GLOBAL, 0);
quick_symbol (abfd, U("_imp__"), exp->internal_name, "", id5, BSF_GLOBAL, 0);
bfd_set_section_size (abfd, tx, jmp_byte_count);
Index: emultempl/pe.em
===================================================================
RCS file: /homes/khan/src/CVSROOT/binutils-19990911/ld/emultempl/pe.em,v
retrieving revision 1.2
diff -u -3 -p -r1.2 pe.em
--- pe.em 1999/12/23 07:55:59 1.2
+++ pe.em 1999/12/23 10:01:26
@@ -87,6 +87,8 @@ static char *pe_out_def_filename = 0;
extern int pe_dll_export_everything;
extern int pe_dll_kill_ats;
extern int pe_dll_stdcall_aliases;
+extern int pe_dll_warn_dup_exports;
+extern int pe_dll_compat_implib;
static int pe_enable_stdcall_fixup = -1; /* 0=disable 1=enable */
static char *pe_implib_filename = 0;
static int pe_enable_auto_image_base = 0;
@@ -132,6 +134,8 @@ gld_${EMULATION_NAME}_before_parse()
#define OPTION_THUMB_ENTRY (OPTION_IMPLIB_FILENAME + 1)
#define OPTION_ENABLE_AUTO_IMAGE_BASE (OPTION_THUMB_ENTRY + 1)
#define OPTION_DISABLE_AUTO_IMAGE_BASE (OPTION_ENABLE_AUTO_IMAGE_BASE + 1)
+#define OPTION_WARN_DUPLICATE_EXPORTS (OPTION_DISABLE_AUTO_IMAGE_BASE + 1)
+#define OPTION_IMP_COMPAT (OPTION_WARN_DUPLICATE_EXPORTS + 1)
static struct option longopts[] =
{
@@ -166,6 +170,8 @@ static struct option longopts[] =
{"out-implib", required_argument, NULL, OPTION_IMPLIB_FILENAME},
{"enable-auto-image-base", no_argument, NULL, OPTION_ENABLE_AUTO_IMAGE_BASE},
{"disable-auto-image-base", no_argument, NULL, OPTION_DISABLE_AUTO_IMAGE_BASE},
+ {"warn-duplicate-exports", no_argument, NULL, OPTION_WARN_DUPLICATE_EXPORTS},
+ {"compat-implib", no_argument, NULL, OPTION_IMP_COMPAT},
#endif
{NULL, no_argument, NULL, 0}
};
@@ -241,6 +247,9 @@ gld_${EMULATION_NAME}_list_options (file
fprintf (file, _(" --enable-auto-image-base Automatically choose image base for DLLs\n"));
fprintf (file, _(" unless user specifies one\n"));
fprintf (file, _(" --disable-auto-image-base Do not automatically choose image base.\n"));
+ fprintf (file, _(" --warn-duplicate-exports Warn about duplicate exports.\n"));
+ fprintf (file, _(" --compat-implib Create backward compatible import libs;\n"));
+ fprintf (file, _(" create __imp_<SYMBOL> as well.\n"));
#endif
}
@@ -473,6 +482,12 @@ gld_${EMULATION_NAME}_parse_args(argc, a
break;
case OPTION_DISABLE_AUTO_IMAGE_BASE:
pe_enable_auto_image_base = 0;
+ break;
+ case OPTION_WARN_DUPLICATE_EXPORTS:
+ pe_dll_warn_dup_exports = 1;
+ break;
+ case OPTION_IMP_COMPAT:
+ pe_dll_compat_implib = 1;
break;
#endif
}