Apply Mumit Khan's patch to implement --compat-implib command line switch
This commit is contained in:
parent
0752a4049e
commit
5f0f29c341
|
@ -1,3 +1,12 @@
|
||||||
|
2000-01-04 Mumit Khan <khan@xraylith.wisc.edu>
|
||||||
|
|
||||||
|
* dlltool.c (create_compat_implib): New variable.
|
||||||
|
(gen_exp_file): Use.
|
||||||
|
(make_one_lib_file): Use.
|
||||||
|
(long_options): Add --compat-implib option.
|
||||||
|
(usage): Handle.
|
||||||
|
(main): Handle.
|
||||||
|
|
||||||
2000-01-03 Nick Clifton <nickc@cygnus.com>
|
2000-01-03 Nick Clifton <nickc@cygnus.com>
|
||||||
|
|
||||||
* binutils.texi: Document new, ARM specific disassembler
|
* binutils.texi: Document new, ARM specific disassembler
|
||||||
|
|
|
@ -367,6 +367,10 @@ static boolean do_default_excludes;
|
||||||
/* Default symbols to exclude when exporting all the symbols. */
|
/* Default symbols to exclude when exporting all the symbols. */
|
||||||
static const char *default_excludes = "DllMain@12,DllEntryPoint@0,impure_ptr";
|
static const char *default_excludes = "DllMain@12,DllEntryPoint@0,impure_ptr";
|
||||||
|
|
||||||
|
/* True if we should add __imp_<SYMBOL> to import libraries for backward
|
||||||
|
compatibility to old Cygwin releases. */
|
||||||
|
static boolean create_compat_implib;
|
||||||
|
|
||||||
static char *def_file;
|
static char *def_file;
|
||||||
|
|
||||||
extern char * program_name;
|
extern char * program_name;
|
||||||
|
@ -1229,7 +1233,7 @@ scan_drectve_symbols (abfd)
|
||||||
|
|
||||||
/* Search for -export: strings. The exported symbols can optionally
|
/* Search for -export: strings. The exported symbols can optionally
|
||||||
have type tags (eg., -export:foo,data), so handle those as well.
|
have type tags (eg., -export:foo,data), so handle those as well.
|
||||||
Currently only data tag is supported. */
|
Currently only data tag is supported. */
|
||||||
p = buf;
|
p = buf;
|
||||||
e = buf + size;
|
e = buf + size;
|
||||||
while (p < e)
|
while (p < e)
|
||||||
|
@ -1267,7 +1271,7 @@ scan_drectve_symbols (abfd)
|
||||||
char *exported_name = xstrdup (c);
|
char *exported_name = xstrdup (c);
|
||||||
char *atsym = strchr (exported_name, '@');
|
char *atsym = strchr (exported_name, '@');
|
||||||
*atsym = '\0';
|
*atsym = '\0';
|
||||||
/* Note: stdcall alias symbols can never be data. */
|
/* Note: stdcall alias symbols can never be data. */
|
||||||
def_exports (exported_name, xstrdup (c), -1, 0, 0, 0);
|
def_exports (exported_name, xstrdup (c), -1, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1879,9 +1883,9 @@ gen_exp_file ()
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int l;
|
int l;
|
||||||
/* We dont output as ascii 'cause there can
|
|
||||||
be quote characters in the string */
|
|
||||||
|
|
||||||
|
/* We don't output as ascii because there can
|
||||||
|
be quote characters in the string. */
|
||||||
l = 0;
|
l = 0;
|
||||||
for (p = dl->text; *p; p++)
|
for (p = dl->text; *p; p++)
|
||||||
{
|
{
|
||||||
|
@ -1907,7 +1911,7 @@ gen_exp_file ()
|
||||||
|
|
||||||
|
|
||||||
/* Add to the output file a way of getting to the exported names
|
/* Add to the output file a way of getting to the exported names
|
||||||
without using the import library. */
|
without using the import library. */
|
||||||
if (add_indirect)
|
if (add_indirect)
|
||||||
{
|
{
|
||||||
fprintf (f, "\t.section\t.rdata\n");
|
fprintf (f, "\t.section\t.rdata\n");
|
||||||
|
@ -1917,9 +1921,11 @@ gen_exp_file ()
|
||||||
/* We use a single underscore for MS compatibility, and a
|
/* We use a single underscore for MS compatibility, and a
|
||||||
double underscore for backward compatibility with old
|
double underscore for backward compatibility with old
|
||||||
cygwin releases. */
|
cygwin releases. */
|
||||||
fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
|
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\n", ASM_GLOBAL, exp->name);
|
||||||
fprintf (f, "__imp_%s:\n", exp->name);
|
if (create_compat_implib)
|
||||||
|
fprintf (f, "__imp_%s:\n", exp->name);
|
||||||
fprintf (f, "_imp__%s:\n", exp->name);
|
fprintf (f, "_imp__%s:\n", exp->name);
|
||||||
fprintf (f, "\t%s\t%s\n", ASM_LONG, exp->name);
|
fprintf (f, "\t%s\t%s\n", ASM_LONG, exp->name);
|
||||||
}
|
}
|
||||||
|
@ -2178,10 +2184,12 @@ make_one_lib_file (exp, i)
|
||||||
f = fopen (name, FOPEN_WT);
|
f = fopen (name, FOPEN_WT);
|
||||||
fprintf (f, "\t.text\n");
|
fprintf (f, "\t.text\n");
|
||||||
fprintf (f, "\t%s\t%s%s\n", ASM_GLOBAL, ASM_PREFIX, exp->name);
|
fprintf (f, "\t%s\t%s%s\n", ASM_GLOBAL, ASM_PREFIX, exp->name);
|
||||||
fprintf (f, "\t%s\t__imp_%s\n", ASM_GLOBAL, exp->name);
|
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\n", ASM_GLOBAL, exp->name);
|
||||||
fprintf (f, "%s%s:\n\t%s\t__imp_%s\n", ASM_PREFIX,
|
if (create_compat_implib)
|
||||||
exp->name, ASM_JUMP, exp->name);
|
fprintf (f, "%s%s:\n\t%s\t__imp_%s\n", ASM_PREFIX,
|
||||||
|
exp->name, ASM_JUMP, exp->name);
|
||||||
|
|
||||||
fprintf (f, "\t.section\t.idata$7\t%s To force loading of head\n", ASM_C);
|
fprintf (f, "\t.section\t.idata$7\t%s To force loading of head\n", ASM_C);
|
||||||
fprintf (f, "\t%s\t%s\n", ASM_LONG, head_label);
|
fprintf (f, "\t%s\t%s\n", ASM_LONG, head_label);
|
||||||
|
@ -2190,7 +2198,8 @@ make_one_lib_file (exp, i)
|
||||||
fprintf (f,"%s Import Address Table\n", ASM_C);
|
fprintf (f,"%s Import Address Table\n", ASM_C);
|
||||||
|
|
||||||
fprintf (f, "\t.section .idata$5\n");
|
fprintf (f, "\t.section .idata$5\n");
|
||||||
fprintf (f, "__imp_%s:\n", exp->name);
|
if (create_compat_implib)
|
||||||
|
fprintf (f, "__imp_%s:\n", exp->name);
|
||||||
fprintf (f, "_imp__%s:\n", exp->name);
|
fprintf (f, "_imp__%s:\n", exp->name);
|
||||||
|
|
||||||
dump_iat (f, exp);
|
dump_iat (f, exp);
|
||||||
|
@ -2311,13 +2320,16 @@ make_one_lib_file (exp, i)
|
||||||
/* Generate imp symbols with one underscore for Microsoft
|
/* Generate imp symbols with one underscore for Microsoft
|
||||||
compatibility, and with two underscores for backward
|
compatibility, and with two underscores for backward
|
||||||
compatibility with old versions of cygwin. */
|
compatibility with old versions of cygwin. */
|
||||||
iname = bfd_make_empty_symbol(abfd);
|
if (create_compat_implib)
|
||||||
iname->name = make_label ("__imp_", exp->name);
|
{
|
||||||
iname->section = secdata[IDATA5].sec;
|
iname = bfd_make_empty_symbol (abfd);
|
||||||
iname->flags = BSF_GLOBAL;
|
iname->name = make_label ("__imp_", exp->name);
|
||||||
iname->value = 0;
|
iname->section = secdata[IDATA5].sec;
|
||||||
|
iname->flags = BSF_GLOBAL;
|
||||||
|
iname->value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
iname2 = bfd_make_empty_symbol(abfd);
|
iname2 = bfd_make_empty_symbol (abfd);
|
||||||
iname2->name = make_label ("_imp__", exp->name);
|
iname2->name = make_label ("_imp__", exp->name);
|
||||||
iname2->section = secdata[IDATA5].sec;
|
iname2->section = secdata[IDATA5].sec;
|
||||||
iname2->flags = BSF_GLOBAL;
|
iname2->flags = BSF_GLOBAL;
|
||||||
|
@ -2332,7 +2344,8 @@ make_one_lib_file (exp, i)
|
||||||
|
|
||||||
|
|
||||||
iname_pp = ptrs + oidx;
|
iname_pp = ptrs + oidx;
|
||||||
ptrs[oidx++] = iname;
|
if (create_compat_implib)
|
||||||
|
ptrs[oidx++] = iname;
|
||||||
ptrs[oidx++] = iname2;
|
ptrs[oidx++] = iname2;
|
||||||
|
|
||||||
iname_lab_pp = ptrs + oidx;
|
iname_lab_pp = ptrs + oidx;
|
||||||
|
@ -3131,6 +3144,7 @@ usage (file, status)
|
||||||
fprintf (file, _(" -A --add-stdcall-alias Add aliases without @<n>.\n"));
|
fprintf (file, _(" -A --add-stdcall-alias Add aliases without @<n>.\n"));
|
||||||
fprintf (file, _(" -S --as <name> Use <name> for assembler.\n"));
|
fprintf (file, _(" -S --as <name> Use <name> for assembler.\n"));
|
||||||
fprintf (file, _(" -f --as-flags <flags> Pass <flags> to the assembler.\n"));
|
fprintf (file, _(" -f --as-flags <flags> Pass <flags> to the assembler.\n"));
|
||||||
|
fprintf (file, _(" -C --compat-implib Create backward compatible import library.\n"));
|
||||||
fprintf (file, _(" -n --no-delete Keep temp files (repeat for extra preservation).\n"));
|
fprintf (file, _(" -n --no-delete Keep temp files (repeat for extra preservation).\n"));
|
||||||
fprintf (file, _(" -v --verbose Be verbose.\n"));
|
fprintf (file, _(" -v --verbose Be verbose.\n"));
|
||||||
fprintf (file, _(" -V --version Display the program version.\n"));
|
fprintf (file, _(" -V --version Display the program version.\n"));
|
||||||
|
@ -3175,6 +3189,7 @@ static const struct option long_options[] =
|
||||||
{"as", required_argument, NULL, 'S'},
|
{"as", required_argument, NULL, 'S'},
|
||||||
{"as-flags", required_argument, NULL, 'f'},
|
{"as-flags", required_argument, NULL, 'f'},
|
||||||
{"mcore-elf", required_argument, NULL, 'M'},
|
{"mcore-elf", required_argument, NULL, 'M'},
|
||||||
|
{"compat-implib", no_argument, NULL, 'C'},
|
||||||
{NULL,0,NULL,0}
|
{NULL,0,NULL,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3197,9 +3212,9 @@ main (ac, av)
|
||||||
|
|
||||||
while ((c = getopt_long (ac, av,
|
while ((c = getopt_long (ac, av,
|
||||||
#ifdef DLLTOOL_MCORE_ELF
|
#ifdef DLLTOOL_MCORE_ELF
|
||||||
"m:e:l:aD:d:z:b:xcuUkAS:f:nvVhM:L:F:",
|
"m:e:l:aD:d:z:b:xcCuUkAS:f:nvVhM:L:F:",
|
||||||
#else
|
#else
|
||||||
"m:e:l:aD:d:z:b:xcuUkAS:f:nvVh",
|
"m:e:l:aD:d:z:b:xcCuUkAS:f:nvVh",
|
||||||
#endif
|
#endif
|
||||||
long_options, 0))
|
long_options, 0))
|
||||||
!= EOF)
|
!= EOF)
|
||||||
|
@ -3295,6 +3310,9 @@ main (ac, av)
|
||||||
mcore_elf_linker_flags = optarg;
|
mcore_elf_linker_flags = optarg;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case 'C':
|
||||||
|
create_compat_implib = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage (stderr, 1);
|
usage (stderr, 1);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue