This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] arm-wince-pe: Prepend underscore to global sym but notimport name
- From: "Craig A. Vanderborgh" <craigv at voxware dot com>
- To: binutils at sources dot redhat dot com
- Date: 13 Mar 2003 12:14:39 -0700
- Subject: [PATCH] arm-wince-pe: Prepend underscore to global sym but notimport name
Greetings, I am submitting the following patch for dlltool (2.13.90).
As this is the first patch I've ever submitted, please let me know if I
am doing something wrong.
This patch adds an option to dlltool (for arm-wince-pe) that permits
creation of import libs for the M$ wince dll's. This patch creates
symbols in an interface library that DO have and underscore prepended
(e.g. _ReadFile) but DO NOT reference the actual import with an
underscore. This permits use of the M$ run-time DLL's (e.g.
coredll.dll) on wince.
craig
2003-03-13 Craig Vanderborgh <craigv at voxware dot com>
zetar% diff -u -p dlltool.c dlltool.c.new
--- dlltool.c 2003-03-13 11:59:18.000000000 -0700
+++ dlltool.c.new 2003-03-13 11:59:05.000000000 -0700
@@ -376,6 +376,10 @@ static const char *default_excludes = "D
compatibility to old Cygwin releases. */
static boolean create_compat_implib;
+/* Prepend underscore to global symbol, but not to the import name.
+ Needed for creating libs from def-files for M$ runtime DLL's. */
+static boolean create_name_with_underscore = 0;
+
static char *def_file;
extern char * program_name;
@@ -2337,7 +2341,11 @@ make_one_lib_file (exp, i)
if (! exp->data)
{
exp_label = bfd_make_empty_symbol (abfd);
- exp_label->name = make_imp_label ("", exp->name);
+ if (create_name_with_underscore)
+ exp_label->name = make_imp_label ("_", exp->name);
+ else
+ exp_label->name = make_imp_label ("", exp->name);
+
/* On PowerPC, the function name points to a descriptor in
the rdata section, the first element of which is a
@@ -3183,6 +3191,7 @@ usage (file, status)
fprintf (file, _(" -x --no-idata4 Don't generate idata$4 section.\n"));
fprintf (file, _(" -c --no-idata5 Don't generate idata$5 section.\n"));
fprintf (file, _(" -U --add-underscore Add underscores to symbols in interface library.\n"));
+ fprintf (file, _(" -N --iface-underscore Add underscores to iface lib syms, not import names.\n"));
fprintf (file, _(" -k --kill-at Kill @<n> from exported names.\n"));
fprintf (file, _(" -A --add-stdcall-alias Add aliases without @<n>.\n"));
fprintf (file, _(" -S --as <name> Use <name> for assembler.\n"));
@@ -3233,6 +3242,7 @@ static const struct option long_options[
{"as-flags", required_argument, NULL, 'f'},
{"mcore-elf", required_argument, NULL, 'M'},
{"compat-implib", no_argument, NULL, 'C'},
+ {"name-with-underscore", no_argument, NULL, 'N'},
{NULL,0,NULL,0}
};
@@ -3262,7 +3272,7 @@ main (ac, av)
#ifdef DLLTOOL_MCORE_ELF
"m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHhM:L:F:",
#else
- "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHh",
+ "m:e:l:aD:d:z:b:xcCuUkAS:f:nvVHhN",
#endif
long_options, 0))
!= EOF)
@@ -3328,6 +3338,9 @@ main (ac, av)
case 'U':
add_underscore = 1;
break;
+ case 'N':
+ create_name_with_underscore = 1;
+ break;
case 'k':
killat = 1;
break;