public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] arm-wince-pe: Prepend underscore to global sym but not import name
@ 2003-03-13 19:23 Craig A. Vanderborgh
  2003-03-17  2:17 ` Christopher Faylor
  0 siblings, 1 reply; 2+ messages in thread
From: Craig A. Vanderborgh @ 2003-03-13 19:23 UTC (permalink / raw)
  To: binutils

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@voxware.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;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm-wince-pe: Prepend underscore to global sym but not import name
  2003-03-13 19:23 [PATCH] arm-wince-pe: Prepend underscore to global sym but not import name Craig A. Vanderborgh
@ 2003-03-17  2:17 ` Christopher Faylor
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Faylor @ 2003-03-17  2:17 UTC (permalink / raw)
  To: binutils

On Thu, Mar 13, 2003 at 12:14:39PM -0700, Craig A. Vanderborgh wrote:
>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.

There are a couple of things wrong, unfortunately.

- Incorrect formatting.  Check out http://www.gnu.org/prep/standards.html
  but really you just should be adhering to the standards of the code you
  are working on.  The code below seems to have some strange indentation.

- No ChangeLog

- Most important - Do you have an assignment on file with the FSF so that
  your patches can be accepted?

As to the patch itself, it seems like the functionality you're adding is
something that should be implicit for the target.  If all of the symbols
for the target lack (or don't) an underscore then shouldn't all of the
tools should default to that?

cgf

>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@voxware.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;
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-17  2:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-13 19:23 [PATCH] arm-wince-pe: Prepend underscore to global sym but not import name Craig A. Vanderborgh
2003-03-17  2:17 ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).