Applied Mumit Kha's patch to tweak dll production code.

This commit is contained in:
Nick Clifton 2000-01-04 23:44:03 +00:00
parent a6483292c2
commit 870df5dcbc
4 changed files with 42 additions and 10 deletions

View File

@ -1,7 +1,21 @@
2000-01-04 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.
* pe-dll.h: Add exports of pe_dll_warn_dup_exports and
pe_dll_compat_implib.
* 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.
* pe-dll.c (pe_dll_generate_implib): Use the correct name for output
dll.
* deffilep.y (opt_name): Allow "." in name.
1999-12-02 Nick Clifton <nickc@cygnus.com>

View File

@ -4,7 +4,7 @@ rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
cat >>e${EMULATION_NAME}.c <<EOF
/* This file is part of GLD, the Gnu Linker.
Copyright 1995, 96, 97, 98, 1999 Free Software Foundation, Inc.
Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -139,6 +139,8 @@ gld_${EMULATION_NAME}_before_parse()
#define OPTION_DISABLE_STDCALL_FIXUP (OPTION_ENABLE_STDCALL_FIXUP + 1)
#define OPTION_IMPLIB_FILENAME (OPTION_DISABLE_STDCALL_FIXUP + 1)
#define OPTION_THUMB_ENTRY (OPTION_IMPLIB_FILENAME + 1)
#define OPTION_WARN_DUPLICATE_EXPORTS (OPTION_THUMB_ENTRY + 1)
#define OPTION_IMP_COMPAT (OPTION_WARN_DUPLICATE_EXPORTS + 1)
static struct option longopts[] =
{
@ -171,6 +173,8 @@ static struct option longopts[] =
{"enable-stdcall-fixup", no_argument, NULL, OPTION_ENABLE_STDCALL_FIXUP},
{"disable-stdcall-fixup", no_argument, NULL, OPTION_DISABLE_STDCALL_FIXUP},
{"out-implib", required_argument, NULL, OPTION_IMPLIB_FILENAME},
{"warn-duplicate-exports", no_argument, NULL, OPTION_WARN_DUPLICATE_EXPORTS},
{"compat-implib", no_argument, NULL, OPTION_IMP_COMPAT},
#endif
{NULL, no_argument, NULL, 0}
};
@ -490,6 +494,12 @@ gld_${EMULATION_NAME}_parse_args(argc, argv)
case OPTION_IMPLIB_FILENAME:
pe_implib_filename = xstrdup (optarg);
break;
case OPTION_WARN_DUPLICATE_EXPORTS:
pe_dll_warn_dup_exports = 1;
break;
case OPTION_IMP_COMPAT:
pe_dll_compat_implib = 1;
break;
#endif
}
return 1;

View File

@ -60,6 +60,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;
/************************************************************************
@ -338,20 +340,22 @@ process_def_file (abfd, info)
{
if (i > 0 && strcmp (e[i].name, e[i - 1].name) == 0)
{
/* This is a duplicate */
/* This is a duplicate. */
if (e[j - 1].ordinal != -1
&& e[i].ordinal != -1
&& e[j - 1].ordinal != e[i].ordinal)
{
/* xgettext:c-format */
einfo (_("%XError, duplicate EXPORT with oridinals: %s (%d vs %d)\n"),
e[j - 1].name, e[j - 1].ordinal, e[i].ordinal);
if (pe_dll_warn_dup_exports)
/* xgettext:c-format */
einfo (_("%XError, duplicate EXPORT with oridinals: %s (%d vs %d)\n"),
e[j - 1].name, e[j - 1].ordinal, e[i].ordinal);
}
else
{
/* xgettext:c-format */
einfo (_("Warning, duplicate EXPORT: %s\n"),
e[j - 1].name);
if (pe_dll_warn_dup_exports)
/* xgettext:c-format */
einfo (_("Warning, duplicate EXPORT: %s\n"),
e[j - 1].name);
}
if (e[i].ordinal)
e[j - 1].ordinal = e[i].ordinal;
@ -1359,7 +1363,9 @@ make_one (exp, parent)
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);
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);
bfd_set_section_size (abfd, tx, jmp_byte_count);
td = (unsigned char *) xmalloc (jmp_byte_count);

View File

@ -1,5 +1,5 @@
/* pe-dll.h: Header file for routines used to build Windows DLLs.
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
@ -31,6 +31,8 @@ extern int pe_dll_export_everything;
extern int pe_dll_do_default_excludes;
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;
extern void pe_dll_id_target PARAMS ((const char *));
extern void pe_dll_add_excludes PARAMS ((const char *));