Don't search for data import when auto-import is disabled.
This commit is contained in:
parent
9c3b31c636
commit
4cd898632a
|
@ -1,3 +1,8 @@
|
||||||
|
2002-12-17 Ralf Habacker <ralf.habacker@freenet.de>
|
||||||
|
|
||||||
|
* ld/emultempl/pe.em (pe_find_data_imports): Don't search for data
|
||||||
|
import when auto-import is disabled.
|
||||||
|
|
||||||
2002-12-17 Danny Smith <dannysmith@users.sourceforge.net>
|
2002-12-17 Danny Smith <dannysmith@users.sourceforge.net>
|
||||||
|
|
||||||
* emultempl/pe.em (..._recognized_file): Use LD_PATHMAX+1 to
|
* emultempl/pe.em (..._recognized_file): Use LD_PATHMAX+1 to
|
||||||
|
|
|
@ -132,7 +132,7 @@ static int make_import_fixup PARAMS ((arelent *, asection *));
|
||||||
static void pe_find_data_imports PARAMS ((void));
|
static void pe_find_data_imports PARAMS ((void));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bfd_boolean pr_sym PARAMS ((struct bfd_hash_entry *, PTR string));
|
static bfd_boolean pr_sym PARAMS ((struct bfd_hash_entry *, PTR));
|
||||||
static bfd_boolean gld_${EMULATION_NAME}_unrecognized_file
|
static bfd_boolean gld_${EMULATION_NAME}_unrecognized_file
|
||||||
PARAMS ((lang_input_statement_type *));
|
PARAMS ((lang_input_statement_type *));
|
||||||
static bfd_boolean gld_${EMULATION_NAME}_recognized_file
|
static bfd_boolean gld_${EMULATION_NAME}_recognized_file
|
||||||
|
@ -148,7 +148,7 @@ static char * thumb_entry_symbol = NULL;
|
||||||
static lang_assignment_statement_type *image_base_statement = 0;
|
static lang_assignment_statement_type *image_base_statement = 0;
|
||||||
|
|
||||||
#ifdef DLL_SUPPORT
|
#ifdef DLL_SUPPORT
|
||||||
static int pe_enable_stdcall_fixup = -1; /* 0=disable 1=enable */
|
static int pe_enable_stdcall_fixup = -1; /* 0=disable 1=enable. */
|
||||||
static char *pe_out_def_filename = NULL;
|
static char *pe_out_def_filename = NULL;
|
||||||
static char *pe_implib_filename = NULL;
|
static char *pe_implib_filename = NULL;
|
||||||
static int pe_enable_auto_image_base = 0;
|
static int pe_enable_auto_image_base = 0;
|
||||||
|
@ -279,7 +279,7 @@ static struct option longopts[] = {
|
||||||
|
|
||||||
|
|
||||||
/* PE/WIN32; added routines to get the subsystem type, heap and/or stack
|
/* PE/WIN32; added routines to get the subsystem type, heap and/or stack
|
||||||
parameters which may be input from the command line */
|
parameters which may be input from the command line. */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -320,6 +320,7 @@ static definfo init[] =
|
||||||
{ NULL, 0, 0, NULL, 0 }
|
{ NULL, 0, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gld_${EMULATION_NAME}_list_options (file)
|
gld_${EMULATION_NAME}_list_options (file)
|
||||||
FILE * file;
|
FILE * file;
|
||||||
|
@ -371,12 +372,14 @@ gld_${EMULATION_NAME}_list_options (file)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pe_name (name, val)
|
set_pe_name (name, val)
|
||||||
char *name;
|
char *name;
|
||||||
long val;
|
long val;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Find the name and set it. */
|
/* Find the name and set it. */
|
||||||
for (i = 0; init[i].ptr; i++)
|
for (i = 0; init[i].ptr; i++)
|
||||||
{
|
{
|
||||||
|
@ -475,7 +478,6 @@ set_pe_subsystem ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pe_value (name)
|
set_pe_value (name)
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -491,6 +493,7 @@ set_pe_value (name)
|
||||||
optarg = end;
|
optarg = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_pe_stack_heap (resname, comname)
|
set_pe_stack_heap (resname, comname)
|
||||||
char *resname;
|
char *resname;
|
||||||
|
@ -508,7 +511,6 @@ set_pe_stack_heap (resname, comname)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gld_${EMULATION_NAME}_parse_args (argc, argv)
|
gld_${EMULATION_NAME}_parse_args (argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
|
@ -549,7 +551,7 @@ gld_${EMULATION_NAME}_parse_args (argc, argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* PE options */
|
/* PE options. */
|
||||||
case OPTION_HEAP:
|
case OPTION_HEAP:
|
||||||
set_pe_stack_heap ("__size_of_heap_reserve__", "__size_of_heap_commit__");
|
set_pe_stack_heap ("__size_of_heap_reserve__", "__size_of_heap_commit__");
|
||||||
break;
|
break;
|
||||||
|
@ -687,6 +689,7 @@ strhash (const char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use the output file to create a image base for relocatable DLLs. */
|
/* Use the output file to create a image base for relocatable DLLs. */
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
compute_dll_image_base (const char *ofile)
|
compute_dll_image_base (const char *ofile)
|
||||||
{
|
{
|
||||||
|
@ -725,7 +728,7 @@ gld_${EMULATION_NAME}_set_symbols ()
|
||||||
if (link_info.relocateable)
|
if (link_info.relocateable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Glue the assignments into the abs section */
|
/* Glue the assignments into the abs section. */
|
||||||
save = stat_ptr;
|
save = stat_ptr;
|
||||||
|
|
||||||
stat_ptr = &(abs_output_section->children);
|
stat_ptr = &(abs_output_section->children);
|
||||||
|
@ -798,7 +801,8 @@ pe_undef_cdecl_match (h, string)
|
||||||
PTR string;
|
PTR string;
|
||||||
{
|
{
|
||||||
int sl;
|
int sl;
|
||||||
sl = strlen (string); /* silence compiler warning */
|
|
||||||
|
sl = strlen (string); /* Silence compiler warning. */
|
||||||
if (h->type == bfd_link_hash_defined
|
if (h->type == bfd_link_hash_defined
|
||||||
&& strncmp (h->root.string, string, sl) == 0
|
&& strncmp (h->root.string, string, sl) == 0
|
||||||
&& h->root.string[sl] == '@')
|
&& h->root.string[sl] == '@')
|
||||||
|
@ -839,6 +843,7 @@ pe_fixup_stdcalls ()
|
||||||
undef->type = bfd_link_hash_defined;
|
undef->type = bfd_link_hash_defined;
|
||||||
undef->u.def.value = sym->u.def.value;
|
undef->u.def.value = sym->u.def.value;
|
||||||
undef->u.def.section = sym->u.def.section;
|
undef->u.def.section = sym->u.def.section;
|
||||||
|
|
||||||
if (pe_enable_stdcall_fixup == -1)
|
if (pe_enable_stdcall_fixup == -1)
|
||||||
{
|
{
|
||||||
einfo (_("Warning: resolving %s by linking to %s\n"),
|
einfo (_("Warning: resolving %s by linking to %s\n"),
|
||||||
|
@ -855,7 +860,7 @@ pe_fixup_stdcalls ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* The symbol is a cdecl symbol, so we look for stdcall
|
/* The symbol is a cdecl symbol, so we look for stdcall
|
||||||
symbols - which means scanning the whole symbol table */
|
symbols - which means scanning the whole symbol table. */
|
||||||
pe_undef_found_sym = 0;
|
pe_undef_found_sym = 0;
|
||||||
bfd_link_hash_traverse (link_info.hash, pe_undef_cdecl_match,
|
bfd_link_hash_traverse (link_info.hash, pe_undef_cdecl_match,
|
||||||
(PTR) undef->root.string);
|
(PTR) undef->root.string);
|
||||||
|
@ -865,6 +870,7 @@ pe_fixup_stdcalls ()
|
||||||
undef->type = bfd_link_hash_defined;
|
undef->type = bfd_link_hash_defined;
|
||||||
undef->u.def.value = sym->u.def.value;
|
undef->u.def.value = sym->u.def.value;
|
||||||
undef->u.def.section = sym->u.def.section;
|
undef->u.def.section = sym->u.def.section;
|
||||||
|
|
||||||
if (pe_enable_stdcall_fixup == -1)
|
if (pe_enable_stdcall_fixup == -1)
|
||||||
{
|
{
|
||||||
einfo (_("Warning: resolving %s by linking to %s\n"),
|
einfo (_("Warning: resolving %s by linking to %s\n"),
|
||||||
|
@ -907,11 +913,14 @@ pe_find_data_imports ()
|
||||||
{
|
{
|
||||||
struct bfd_link_hash_entry *undef, *sym;
|
struct bfd_link_hash_entry *undef, *sym;
|
||||||
|
|
||||||
|
if (link_info.pei386_auto_import == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (undef = link_info.hash->undefs; undef; undef=undef->next)
|
for (undef = link_info.hash->undefs; undef; undef=undef->next)
|
||||||
{
|
{
|
||||||
if (undef->type == bfd_link_hash_undefined)
|
if (undef->type == bfd_link_hash_undefined)
|
||||||
{
|
{
|
||||||
/* C++ symbols are *long* */
|
/* C++ symbols are *long*. */
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
if (pe_dll_extra_pe_debug)
|
if (pe_dll_extra_pe_debug)
|
||||||
|
@ -922,16 +931,15 @@ pe_find_data_imports ()
|
||||||
sym = bfd_link_hash_lookup (link_info.hash, buf, 0, 0, 1);
|
sym = bfd_link_hash_lookup (link_info.hash, buf, 0, 0, 1);
|
||||||
|
|
||||||
if (sym && sym->type == bfd_link_hash_defined)
|
if (sym && sym->type == bfd_link_hash_defined)
|
||||||
{
|
|
||||||
if (link_info.pei386_auto_import == -1)
|
|
||||||
info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
|
|
||||||
undef->root.string, buf);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
bfd *b = sym->u.def.section->owner;
|
bfd *b = sym->u.def.section->owner;
|
||||||
asymbol **symbols;
|
asymbol **symbols;
|
||||||
int nsyms, symsize, i;
|
int nsyms, symsize, i;
|
||||||
|
|
||||||
|
if (link_info.pei386_auto_import == -1)
|
||||||
|
info_msg (_("Info: resolving %s by linking to %s (auto-import)\n"),
|
||||||
|
undef->root.string, buf);
|
||||||
|
|
||||||
symsize = bfd_get_symtab_upper_bound (b);
|
symsize = bfd_get_symtab_upper_bound (b);
|
||||||
symbols = (asymbol **) xmalloc (symsize);
|
symbols = (asymbol **) xmalloc (symsize);
|
||||||
nsyms = bfd_canonicalize_symtab (b, symbols);
|
nsyms = bfd_canonicalize_symtab (b, symbols);
|
||||||
|
@ -949,7 +957,6 @@ pe_find_data_imports ()
|
||||||
sizeof ("__head_") - 1);
|
sizeof ("__head_") - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pe_walk_relocs_of_symbol (&link_info, undef->root.string,
|
pe_walk_relocs_of_symbol (&link_info, undef->root.string,
|
||||||
make_import_fixup);
|
make_import_fixup);
|
||||||
|
@ -1345,7 +1352,7 @@ gld_${EMULATION_NAME}_unrecognized_file (entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Not sure if these *should* be set */
|
/* Not sure if these *should* be set. */
|
||||||
if (pe_def_file->version_major != -1)
|
if (pe_def_file->version_major != -1)
|
||||||
{
|
{
|
||||||
pe.MajorImageVersion = pe_def_file->version_major;
|
pe.MajorImageVersion = pe_def_file->version_major;
|
||||||
|
@ -1854,22 +1861,22 @@ gld_${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
|
||||||
giving up -- once here, and once when searching for a "static" lib.
|
giving up -- once here, and once when searching for a "static" lib.
|
||||||
for a "static" lib. */
|
for a "static" lib. */
|
||||||
/* Try "libfoo.a" (import lib, or static lib, but must
|
/* Try "libfoo.a" (import lib, or static lib, but must
|
||||||
take precedence over dll's) */
|
take precedence over dll's). */
|
||||||
sprintf (string, "%s/lib%s.a", search->name, filename);
|
sprintf (string, "%s/lib%s.a", search->name, filename);
|
||||||
if (! ldfile_try_open_bfd (string, entry))
|
if (! ldfile_try_open_bfd (string, entry))
|
||||||
{
|
{
|
||||||
#ifdef DLL_SUPPORT
|
#ifdef DLL_SUPPORT
|
||||||
if (pe_dll_search_prefix)
|
if (pe_dll_search_prefix)
|
||||||
{
|
{
|
||||||
/* Try "<prefix>foo.dll" (preferred dll name, if specified) */
|
/* Try "<prefix>foo.dll" (preferred dll name, if specified). */
|
||||||
sprintf (string, "%s/%s%s.dll", search->name, pe_dll_search_prefix, filename);
|
sprintf (string, "%s/%s%s.dll", search->name, pe_dll_search_prefix, filename);
|
||||||
if (! ldfile_try_open_bfd (string, entry))
|
if (! ldfile_try_open_bfd (string, entry))
|
||||||
{
|
{
|
||||||
/* Try "libfoo.dll" (default preferred dll name) */
|
/* Try "libfoo.dll" (default preferred dll name). */
|
||||||
sprintf (string, "%s/lib%s.dll", search->name, filename);
|
sprintf (string, "%s/lib%s.dll", search->name, filename);
|
||||||
if (! ldfile_try_open_bfd (string, entry))
|
if (! ldfile_try_open_bfd (string, entry))
|
||||||
{
|
{
|
||||||
/* Finally, try "foo.dll" (alternate dll name) */
|
/* Finally, try "foo.dll" (alternate dll name). */
|
||||||
sprintf (string, "%s/%s.dll", search->name, filename);
|
sprintf (string, "%s/%s.dll", search->name, filename);
|
||||||
if (! ldfile_try_open_bfd (string, entry))
|
if (! ldfile_try_open_bfd (string, entry))
|
||||||
{
|
{
|
||||||
|
@ -1955,8 +1962,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||||
gld_${EMULATION_NAME}_get_script,
|
gld_${EMULATION_NAME}_get_script,
|
||||||
"${EMULATION_NAME}",
|
"${EMULATION_NAME}",
|
||||||
"${OUTPUT_FORMAT}",
|
"${OUTPUT_FORMAT}",
|
||||||
gld_${EMULATION_NAME}_finish, /* finish */
|
gld_${EMULATION_NAME}_finish,
|
||||||
NULL, /* create output section statements */
|
NULL, /* Create output section statements. */
|
||||||
gld_${EMULATION_NAME}_open_dynamic_archive,
|
gld_${EMULATION_NAME}_open_dynamic_archive,
|
||||||
gld_${EMULATION_NAME}_place_orphan,
|
gld_${EMULATION_NAME}_place_orphan,
|
||||||
gld_${EMULATION_NAME}_set_symbols,
|
gld_${EMULATION_NAME}_set_symbols,
|
||||||
|
@ -1965,6 +1972,6 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||||
gld_${EMULATION_NAME}_list_options,
|
gld_${EMULATION_NAME}_list_options,
|
||||||
gld_${EMULATION_NAME}_recognized_file,
|
gld_${EMULATION_NAME}_recognized_file,
|
||||||
gld_${EMULATION_NAME}_find_potential_libraries,
|
gld_${EMULATION_NAME}_find_potential_libraries,
|
||||||
NULL /* new_vers_pattern */
|
NULL /* new_vers_pattern. */
|
||||||
};
|
};
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in New Issue