aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/aix.em8
-rw-r--r--ld/emultempl/elf32.em49
-rw-r--r--ld/emultempl/linux.em2
-rw-r--r--ld/emultempl/pe.em2
-rw-r--r--ld/emultempl/pep.em2
-rw-r--r--ld/emultempl/vms.em2
6 files changed, 38 insertions, 27 deletions
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 4a06c71..caa74a9 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -1509,7 +1509,13 @@ gld${EMULATION_NAME}_open_dynamic_archive (const char *arch,
if (!entry->flags.maybe_archive)
return FALSE;
- path = concat (search->name, "/lib", entry->filename, arch, ".a", NULL);
+ if (entry->flags.full_name_provided)
+ path = concat (search->name, "/", entry->filename,
+ (const char *) NULL);
+ else
+ path = concat (search->name, "/lib", entry->filename, arch, ".a",
+ (const char *) NULL);
+
if (!ldfile_try_open_bfd (path, entry))
{
free (path);
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 789e12c..7ea5adc 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1656,42 +1656,46 @@ gld${EMULATION_NAME}_open_dynamic_archive
{
const char *filename;
char *string;
+ size_t len;
+ bfd_boolean opened = FALSE;
if (! entry->flags.maybe_archive)
return FALSE;
filename = entry->filename;
+ len = strlen (search->name) + strlen (filename);
+ if (entry->flags.full_name_provided)
+ {
+ len += sizeof "/";
+ string = (char *) xmalloc (len);
+ sprintf (string, "%s/%s", search->name, filename);
+ }
+ else
+ {
+ size_t xlen = 0;
- /* This allocates a few bytes too many when EXTRA_SHLIB_EXTENSION
- is defined, but it does not seem worth the headache to optimize
- away those two bytes of space. */
- string = (char *) xmalloc (strlen (search->name)
- + strlen (filename)
- + strlen (arch)
+ len += strlen (arch) + sizeof "/lib.so";
#ifdef EXTRA_SHLIB_EXTENSION
- + strlen (EXTRA_SHLIB_EXTENSION)
+ xlen = (strlen (EXTRA_SHLIB_EXTENSION) > 3
+ ? strlen (EXTRA_SHLIB_EXTENSION) - 3
+ : 0);
#endif
- + sizeof "/lib.so");
-
- sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
-
+ string = (char *) xmalloc (len + xlen);
+ sprintf (string, "%s/lib%s%s.so", search->name, filename, arch);
#ifdef EXTRA_SHLIB_EXTENSION
- /* Try the .so extension first. If that fails build a new filename
- using EXTRA_SHLIB_EXTENSION. */
- if (! ldfile_try_open_bfd (string, entry))
- {
- sprintf (string, "%s/lib%s%s%s", search->name,
- filename, arch, EXTRA_SHLIB_EXTENSION);
+ /* Try the .so extension first. If that fails build a new filename
+ using EXTRA_SHLIB_EXTENSION. */
+ opened = ldfile_try_open_bfd (string, entry);
+ if (!opened)
+ strcpy (string + len - 4, EXTRA_SHLIB_EXTENSION);
#endif
+ }
- if (! ldfile_try_open_bfd (string, entry))
+ if (!opened && !ldfile_try_open_bfd (string, entry))
{
free (string);
return FALSE;
}
-#ifdef EXTRA_SHLIB_EXTENSION
- }
-#endif
entry->filename = string;
@@ -1716,7 +1720,8 @@ gld${EMULATION_NAME}_open_dynamic_archive
/* Rather than duplicating the logic above. Just use the
filename we recorded earlier. */
- filename = lbasename (entry->filename);
+ if (!entry->flags.full_name_provided)
+ filename = lbasename (entry->filename);
bfd_elf_set_dt_needed_name (entry->the_bfd, filename);
}
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index e7fa35d..b30e872 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -61,7 +61,7 @@ gld${EMULATION_NAME}_open_dynamic_archive
{
char *string;
- if (! entry->flags.maybe_archive)
+ if (! entry->flags.maybe_archive || entry->flags.full_name_provided)
return FALSE;
string = (char *) xmalloc (strlen (search->name)
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 6de71bd..67df2bc 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -2108,7 +2108,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
unsigned int i;
- if (! entry->flags.maybe_archive)
+ if (! entry->flags.maybe_archive || entry->flags.full_name_provided)
return FALSE;
filename = entry->filename;
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 9309c11..dca36cc 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1879,7 +1879,7 @@ gld_${EMULATION_NAME}_open_dynamic_archive
unsigned int i;
- if (! entry->flags.maybe_archive)
+ if (! entry->flags.maybe_archive || entry->flags.full_name_provided)
return FALSE;
filename = entry->filename;
diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em
index 08650f5..b1f61d5 100644
--- a/ld/emultempl/vms.em
+++ b/ld/emultempl/vms.em
@@ -57,7 +57,7 @@ gld${EMULATION_NAME}_open_dynamic_archive (const char *arch ATTRIBUTE_UNUSED,
{
char *string;
- if (! entry->flags.maybe_archive)
+ if (! entry->flags.maybe_archive || entry->flags.full_name_provided)
return FALSE;
string = (char *) xmalloc (strlen (search->name)