OSDN Git Service

2009-01-08 Kai Tietz <kai.tietz@onevision.com>
authorKai Tietz <kai.tietz@onevision.com>
Thu, 8 Jan 2009 13:29:14 +0000 (13:29 +0000)
committerKai Tietz <kai.tietz@onevision.com>
Thu, 8 Jan 2009 13:29:14 +0000 (13:29 +0000)
* dlltool.c (use_nul_prefixed_import_tables): New.
(make_head): Make prefix leading zero prefix element for
idata$4 and idata$5 dependent to new flag.
(usage): Add new option  --use-nul-prefixed-import-tables.
(OPTION_USE_NUL_PREFIXED_IMPORT_TABLES): New.
(long_options): Add --use-nul-prefixed-import-tables.
(main): Likewise.
* doc/binutils.texi: Add new option documentation for
--use-nul-prefixed-import-tables.
* NEWS: Add new option.

binutils/ChangeLog
binutils/NEWS
binutils/dlltool.c
binutils/doc/binutils.texi

index 49dd40a..d1776d3 100644 (file)
@@ -1,3 +1,16 @@
+2009-01-08  Kai Tietz  <kai.tietz@onevision.com>
+
+       * dlltool.c (use_nul_prefixed_import_tables): New.
+       (make_head): Make prefix leading zero prefix element for
+       idata$4 and idata$5 dependent to new flag.
+       (usage): Add new option  --use-nul-prefixed-import-tables.
+       (OPTION_USE_NUL_PREFIXED_IMPORT_TABLES): New.
+       (long_options): Add --use-nul-prefixed-import-tables.
+       (main): Likewise.
+       * doc/binutils.texi: Add new option documentation for
+       --use-nul-prefixed-import-tables.
+       * NEWS: Add new option.
+
 2009-01-06  Kai Tietz  <kai.tietz@onevision.com>
 
        * windres.c (set_endianess): Get architecture name
index f31446a..10a1370 100644 (file)
@@ -1,5 +1,8 @@
 -*- text -*-
 
+* Add new option --use-nul-prefixed-import-tables to dlltool to allow fall-
+  back to old import table generation with null element prefix.
+
 * Support for PowerPC booke64 instructions has been removed.  The assembler no
   longer accepts -mbooke32 or -mbooke64 and the disassembler no longer accepts
   -Mbooke32 or -Mbooke64.  Instead, -mbooke and -Mbooke should be used.
index 89508f3..577c8d0 100644 (file)
@@ -371,6 +371,8 @@ static bfd_boolean export_all_symbols;
    exporting all symbols.  */
 static bfd_boolean do_default_excludes = TRUE;
 
+static bfd_boolean use_nul_prefixed_import_tables = FALSE;
+
 /* Default symbols to exclude when exporting all the symbols.  */
 static const char *default_excludes = "DllMain@12,DllEntryPoint@0,impure_ptr";
 
@@ -2720,19 +2722,28 @@ make_head (void)
   if (!no_idata5)
     {
       fprintf (f, "\t.section\t.idata$5\n");
+      if (use_nul_prefixed_import_tables)
+        {
 #ifdef DLLTOOL_MX86_64
-      fprintf (f,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG); /* NULL terminating list.  */
+          fprintf (f,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG);
 #else
-      fprintf (f,"\t%s\t0\n", ASM_LONG); /* NULL terminating list.  */
+          fprintf (f,"\t%s\t0\n", ASM_LONG);
 #endif
+        }
       fprintf (f, "fthunk:\n");
     }
 
   if (!no_idata4)
     {
       fprintf (f, "\t.section\t.idata$4\n");
-      fprintf (f, "\t%s\t0\n", ASM_LONG);
-      fprintf (f, "\t.section  .idata$4\n");
+      if (use_nul_prefixed_import_tables)
+        {
+#ifdef DLLTOOL_MX86_64
+          fprintf (f,"\t%s\t0\n\t%s\t0\n", ASM_LONG, ASM_LONG);
+#else
+          fprintf (f,"\t%s\t0\n", ASM_LONG);
+#endif
+        }
       fprintf (f, "hname:\n");
     }
 
@@ -3356,6 +3367,7 @@ usage (FILE *file, int status)
   fprintf (file, _("   -b --base-file <basefile> Read linker generated base file.\n"));
   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, _("      --use-nul-prefixed-import-tables Use zero prefixed idata$4 and idata$5.\n"));
   fprintf (file, _("   -U --add-underscore       Add underscores to all symbols in interface library.\n"));
   fprintf (file, _("      --add-stdcall-underscore Add underscores to stdcall symbols in interface library.\n"));
   fprintf (file, _("   -k --kill-at              Kill @<n> from exported names.\n"));
@@ -3386,6 +3398,8 @@ usage (FILE *file, int status)
 #define OPTION_EXCLUDE_SYMS            (OPTION_NO_EXPORT_ALL_SYMS + 1)
 #define OPTION_NO_DEFAULT_EXCLUDES     (OPTION_EXCLUDE_SYMS + 1)
 #define OPTION_ADD_STDCALL_UNDERSCORE  (OPTION_NO_DEFAULT_EXCLUDES + 1)
+#define OPTION_USE_NUL_PREFIXED_IMPORT_TABLES \
+  (OPTION_ADD_STDCALL_UNDERSCORE + 1)
 
 static const struct option long_options[] =
 {
@@ -3393,6 +3407,8 @@ static const struct option long_options[] =
   {"dllname", required_argument, NULL, 'D'},
   {"no-idata4", no_argument, NULL, 'x'},
   {"no-idata5", no_argument, NULL, 'c'},
+  {"use-nul-prefixed-import-tables", no_argument, NULL,
+   OPTION_USE_NUL_PREFIXED_IMPORT_TABLES},
   {"output-exp", required_argument, NULL, 'e'},
   {"output-def", required_argument, NULL, 'z'},
   {"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL_SYMS},
@@ -3467,6 +3483,9 @@ main (int ac, char **av)
        case OPTION_NO_DEFAULT_EXCLUDES:
          do_default_excludes = FALSE;
          break;
+       case OPTION_USE_NUL_PREFIXED_IMPORT_TABLES:
+         use_nul_prefixed_import_tables = TRUE;
+         break;
        case OPTION_ADD_STDCALL_UNDERSCORE:
          add_stdcall_underscore = 1;
          break;
index d816e7a..c38b59b 100644 (file)
@@ -3370,6 +3370,7 @@ dlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
         [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}]
         [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
         [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}]
+        [@option{--use-nul-prefixed-import-tables}]
         [@option{-I}|@option{--identify} @var{library-file-name}] [@option{-i}|@option{--interwork}]
         [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
         [@option{-v}|@option{--verbose}]
@@ -3583,6 +3584,12 @@ Specifies that when @command{dlltool} is creating the exports and library
 files it should omit the @code{.idata4} section.  This is for compatibility
 with certain operating systems.
 
+@item --use-nul-prefixed-import-tables
+Specifies that when @command{dlltool} is creating the exports and library
+files it should prefix the @code{.idata4} and @code{.idata5} by zero an
+element. This emulates old gnu import library generation of
+@code{dlltool}. By default this option is turned off.
+
 @item -c
 @itemx --no-idata5
 Specifies that when @command{dlltool} is creating the exports and library