mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
2009-10-28 Kai Tietz <kai.tietz@onevision.com>
* dlltool.c (leading_underscore): New local variable. (asm_prefix): Interpret leading_underscore. (xlate): Likewise. (add_excludes): Use leading_underscore for making symbol name. (gen_exp_file): Use leading_underscore for internal _imp_ symbols. (usage): Add display of --no-leading-underscore and --leading-underscore option. (OPTION_NO_LEADING_UNDERSCORE): New. (OPTION_LEADING_UNDERSCORE): New. (long_options): Add --no-leading-underscore and --leading-underscore option. (main): Handle new options. * doc/binutils.text: Add documentation of the options --no-leading-underscore and --leading-underscore.
This commit is contained in:
parent
0bd7136a92
commit
36d21de541
@ -1,3 +1,22 @@
|
||||
2009-10-28 Kai Tietz <kai.tietz@onevision.com>
|
||||
|
||||
* dlltool.c (leading_underscore): New local variable.
|
||||
(asm_prefix): Interpret leading_underscore.
|
||||
(xlate): Likewise.
|
||||
(add_excludes): Use leading_underscore for making
|
||||
symbol name.
|
||||
(gen_exp_file): Use leading_underscore for internal
|
||||
_imp_ symbols.
|
||||
(usage): Add display of --no-leading-underscore and
|
||||
--leading-underscore option.
|
||||
(OPTION_NO_LEADING_UNDERSCORE): New.
|
||||
(OPTION_LEADING_UNDERSCORE): New.
|
||||
(long_options): Add --no-leading-underscore and
|
||||
--leading-underscore option.
|
||||
(main): Handle new options.
|
||||
* doc/binutils.text: Add documentation of the options
|
||||
--no-leading-underscore and --leading-underscore.
|
||||
|
||||
2009-10-23 Kai Tietz <kai.tietz@onevision.com>
|
||||
|
||||
* deflex.l: Allow '<' and '>' in ID names.
|
||||
|
@ -394,6 +394,11 @@ static char *dll_name;
|
||||
static int add_indirect = 0;
|
||||
static int add_underscore = 0;
|
||||
static int add_stdcall_underscore = 0;
|
||||
/* This variable can hold three different values. The value
|
||||
-1 (default) means that default underscoring should be used,
|
||||
zero means that no underscoring should be done, and one
|
||||
indicates that underscoring should be done. */
|
||||
static int leading_underscore = -1;
|
||||
static int dontdeltemps = 0;
|
||||
|
||||
/* TRUE if we should export all symbols. Otherwise, we only export
|
||||
@ -936,7 +941,7 @@ asm_prefix (int machine, const char *name)
|
||||
case M386:
|
||||
case MX86:
|
||||
/* Symbol names starting with ? do not have a leading underscore. */
|
||||
if (name && *name == '?')
|
||||
if ((name && *name == '?') || leading_underscore == 0)
|
||||
break;
|
||||
else
|
||||
return "_";
|
||||
@ -1488,7 +1493,8 @@ add_excludes (const char *new_excludes)
|
||||
if (*exclude_string == '@')
|
||||
sprintf (new_exclude->string, "%s", exclude_string);
|
||||
else
|
||||
sprintf (new_exclude->string, "_%s", exclude_string);
|
||||
sprintf (new_exclude->string, "%s%s", (!leading_underscore ? "" : "_"),
|
||||
exclude_string);
|
||||
new_exclude->next = excludes;
|
||||
excludes = new_exclude;
|
||||
|
||||
@ -2100,10 +2106,11 @@ gen_exp_file (void)
|
||||
cygwin releases. */
|
||||
if (create_compat_implib)
|
||||
fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
|
||||
fprintf (f, "\t%s\t_imp__%s\n", ASM_GLOBAL, exp->name);
|
||||
fprintf (f, "\t%s\t_imp_%s%s\n", ASM_GLOBAL,
|
||||
(!leading_underscore ? "" : "_"), exp->name);
|
||||
if (create_compat_implib)
|
||||
fprintf (f, "__imp_%s:\n", exp->name);
|
||||
fprintf (f, "_imp__%s:\n", exp->name);
|
||||
fprintf (f, "_imp_%s%s:\n", (!leading_underscore ? "" : "_"), exp->name);
|
||||
fprintf (f, "\t%s\t%s\n", ASM_LONG, exp->name);
|
||||
}
|
||||
}
|
||||
@ -2182,10 +2189,10 @@ static const char *
|
||||
xlate (const char *name)
|
||||
{
|
||||
int lead_at = (*name == '@');
|
||||
int is_stdcall = (!lead_at && strchr (name, '@') != NULL);
|
||||
|
||||
if (!lead_at && (add_underscore
|
||||
|| (add_stdcall_underscore
|
||||
&& strchr (name, '@'))))
|
||||
|| (add_stdcall_underscore && is_stdcall)))
|
||||
{
|
||||
char *copy = xmalloc (strlen (name) + 2);
|
||||
|
||||
@ -3872,6 +3879,8 @@ usage (FILE *file, int status)
|
||||
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, _(" --no-leading-underscore All symbols shouldn't be prefixed by an underscore.\n"));
|
||||
fprintf (file, _(" --leading-underscore All symbols should be prefixed by an underscore.\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, _(" -p --ext-prefix-alias <prefix> Add aliases with <prefix>.\n"));
|
||||
@ -3904,6 +3913,8 @@ usage (FILE *file, int status)
|
||||
#define OPTION_USE_NUL_PREFIXED_IMPORT_TABLES \
|
||||
(OPTION_ADD_STDCALL_UNDERSCORE + 1)
|
||||
#define OPTION_IDENTIFY_STRICT (OPTION_USE_NUL_PREFIXED_IMPORT_TABLES + 1)
|
||||
#define OPTION_NO_LEADING_UNDERSCORE (OPTION_IDENTIFY_STRICT + 1)
|
||||
#define OPTION_LEADING_UNDERSCORE (OPTION_NO_LEADING_UNDERSCORE + 1)
|
||||
|
||||
static const struct option long_options[] =
|
||||
{
|
||||
@ -3924,6 +3935,8 @@ static const struct option long_options[] =
|
||||
{"input-def", required_argument, NULL, 'd'},
|
||||
{"add-underscore", no_argument, NULL, 'U'},
|
||||
{"add-stdcall-underscore", no_argument, NULL, OPTION_ADD_STDCALL_UNDERSCORE},
|
||||
{"no-leading-underscore", no_argument, NULL, OPTION_NO_LEADING_UNDERSCORE},
|
||||
{"leading-underscore", no_argument, NULL, OPTION_LEADING_UNDERSCORE},
|
||||
{"kill-at", no_argument, NULL, 'k'},
|
||||
{"add-stdcall-alias", no_argument, NULL, 'A'},
|
||||
{"ext-prefix-alias", required_argument, NULL, 'p'},
|
||||
@ -3995,6 +4008,12 @@ main (int ac, char **av)
|
||||
case OPTION_ADD_STDCALL_UNDERSCORE:
|
||||
add_stdcall_underscore = 1;
|
||||
break;
|
||||
case OPTION_NO_LEADING_UNDERSCORE:
|
||||
leading_underscore = 0;
|
||||
break;
|
||||
case OPTION_LEADING_UNDERSCORE:
|
||||
leading_underscore = 1;
|
||||
break;
|
||||
case OPTION_IDENTIFY_STRICT:
|
||||
identify_strict = 1;
|
||||
break;
|
||||
|
@ -3509,6 +3509,7 @@ dlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
|
||||
[@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
|
||||
[@option{-v}|@option{--verbose}]
|
||||
[@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
|
||||
[@option{--no-leading-underscore}] [@option{--leading-underscore}]
|
||||
[object-file @dots{}]
|
||||
@c man end
|
||||
@end smallexample
|
||||
@ -3697,6 +3698,11 @@ means!
|
||||
Specifies that when @command{dlltool} is creating the exports file it
|
||||
should prepend an underscore to the names of @emph{all} exported symbols.
|
||||
|
||||
@item --no-leading-underscore
|
||||
@item --leading-underscore
|
||||
Specifies whether standard symbol should be forced to be prefixed, or
|
||||
not.
|
||||
|
||||
@item --add-stdcall-underscore
|
||||
Specifies that when @command{dlltool} is creating the exports file it
|
||||
should prepend an underscore to the names of exported @emph{stdcall}
|
||||
|
Loading…
Reference in New Issue
Block a user