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;
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, '/');