From: Kai Tietz Date: Thu, 8 Jan 2009 13:29:14 +0000 (+0000) Subject: 2009-01-08 Kai Tietz X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e77b97d43359df06713529ec054ed1ed8afb3e37;p=binutils-gdb.git 2009-01-08 Kai Tietz * 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. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 49dd40a0831..d1776d338b3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,16 @@ +2009-01-08 Kai Tietz + + * 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 * windres.c (set_endianess): Get architecture name diff --git a/binutils/NEWS b/binutils/NEWS index f31446aba5d..10a13703ff7 100644 --- a/binutils/NEWS +++ b/binutils/NEWS @@ -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. diff --git a/binutils/dlltool.c b/binutils/dlltool.c index 89508f32ae9..577c8d0bf4c 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -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 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 @ 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; diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index d816e7a1965..c38b59b4946 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -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