From 602e90d3d506e5953083dc049b8082f58b880089 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Fri, 7 Jul 2000 20:09:28 +0000 Subject: [PATCH] * ld/emultempl/pe.em: institute the following search order for dynamic libraries on pei386: libfoo.dll.a, foo.dll.a (import libs), libfoo.dll, foo.dll (link direct to dll). Fall back to static lib (libfoo.a) if none of the above are found. --- ld/ChangeLog | 7 +++++++ ld/emultempl/pe.em | 27 ++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index d94af082ae7..a4775999eb1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +Wed Jul 05 03:18:00 2000 Charles Wilson + + * ld/emultempl/pe.em: institute the following search order for + dynamic libraries on pei386: libfoo.dll.a, foo.dll.a (import + libs), libfoo.dll, foo.dll (link direct to dll). Fall back to + static lib (libfoo.a) if none of the above are found. + 2000-07-07 Mumit Khan * ld/emultempl/pe.em (pe_enable_auto_image_base): New variable. diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index c7cb96cc99b..92af07e7b91 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1369,24 +1369,33 @@ gld_${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) string = (char *) xmalloc (strlen (search->name) + strlen (filename) - + sizeof "/lib.dll" + + sizeof "/lib.a.dll" + 1); - /* Try "foo.dll" first. */ - sprintf (string, "%s/%s.dll", search->name, filename); + /* Try "libfoo.dll.a" first (preferred explicit import library for dll's */ + sprintf (string, "%s/lib%s.dll.a", search->name, filename); if (! ldfile_try_open_bfd (string, entry)) { - /* Try "libfoo.dll" next. */ - sprintf (string, "%s/lib%s.dll", search->name, filename); - + /* Try "foo.dll.a" next (alternate explicit import library for dll's */ + sprintf (string, "%s/%s.dll.a", search->name, filename); if (! ldfile_try_open_bfd (string, entry)) { - free (string); - return false; + /* Try "libfoo.dll" (preferred dll name) */ + sprintf (string, "%s/lib%s.dll", search->name, filename); + if (! ldfile_try_open_bfd (string, entry)) + { + /* Finally, try "foo.dll" (alternate dll name) */ + sprintf (string, "%s/%s.dll", search->name, filename); + if (! ldfile_try_open_bfd (string, entry)) + { + free (string); + return false; + } + } } } - + entry->filename = string; return true; -- 2.30.2