diff options
Diffstat (limited to 'ld/emultempl/elf32.em')
-rw-r--r-- | ld/emultempl/elf32.em | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index e33e0ca5fc7..f2ff4d89b23 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -95,24 +95,31 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) filename = entry->filename; + /* 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) +#ifdef EXTRA_SHLIB_EXTENSION + + strlen (EXTRA_SHLIB_EXTENSION) +#endif + sizeof "/lib.so"); 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)) - { - /* It failed using .so, try again with .sl for oddball systems - that use a different naming scheme (ie hpux). */ - sprintf (string, "%s/lib%s%s.sl", search->name, filename, arch); + sprintf (string, "%s/lib%s%s%s", search->name, + filename, arch, EXTRA_SHLIB_EXTENSION); +#endif - if (! ldfile_try_open_bfd (string, entry)) - { - free (string); - return false; - } + if (! ldfile_try_open_bfd (string, entry)) + { + free (string); + return false; } entry->filename = string; @@ -133,12 +140,12 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) if (bfd_check_format (entry->the_bfd, bfd_object) && (entry->the_bfd->flags & DYNAMIC) != 0) { - char *filname, *needed_name; + char *needed_name; ASSERT (entry->is_archive && entry->search_dirs_flag); /* Rather than duplicating the logic above. Just use the - filename we recorded earlier.o + filename we recorded earlier. First strip off everything before the last '/'. */ filename = strrchr (entry->filename, '/'); |