mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
* ldfile.c (ldfile_open_file_search): Use concat.
(try_open): Don't use a fixed size pathname buffer. (ldfile_find_command_file): Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive): If using EXTRA_SHLIB_EXTENSION, don't open twice.
This commit is contained in:
parent
4dd07732f2
commit
a26cc96746
@ -1,3 +1,11 @@
|
||||
2008-08-08 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* ldfile.c (ldfile_open_file_search): Use concat.
|
||||
(try_open): Don't use a fixed size pathname buffer.
|
||||
(ldfile_find_command_file): Likewise.
|
||||
* emultempl/elf32.em (gld${EMULATION_NAME}_open_dynamic_archive): If
|
||||
using EXTRA_SHLIB_EXTENSION, don't open twice.
|
||||
|
||||
2008-08-04 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* Makefile.am (POTFILES.in): Set LC_ALL=C.
|
||||
|
@ -1516,8 +1516,9 @@ gld${EMULATION_NAME}_open_dynamic_archive
|
||||
/* 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);
|
||||
{
|
||||
sprintf (string, "%s/lib%s%s%s", search->name,
|
||||
filename, arch, EXTRA_SHLIB_EXTENSION);
|
||||
#endif
|
||||
|
||||
if (! ldfile_try_open_bfd (string, entry))
|
||||
@ -1525,6 +1526,9 @@ gld${EMULATION_NAME}_open_dynamic_archive
|
||||
free (string);
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef EXTRA_SHLIB_EXTENSION
|
||||
}
|
||||
#endif
|
||||
|
||||
entry->filename = string;
|
||||
|
||||
|
26
ld/ldfile.c
26
ld/ldfile.c
@ -343,19 +343,12 @@ ldfile_open_file_search (const char *arch,
|
||||
}
|
||||
}
|
||||
|
||||
string = xmalloc (strlen (search->name)
|
||||
+ strlen (slash)
|
||||
+ strlen (lib)
|
||||
+ strlen (entry->filename)
|
||||
+ strlen (arch)
|
||||
+ strlen (suffix)
|
||||
+ 1);
|
||||
|
||||
if (entry->is_archive)
|
||||
sprintf (string, "%s%s%s%s%s%s", search->name, slash,
|
||||
lib, entry->filename, arch, suffix);
|
||||
string = concat (search->name, slash, lib, entry->filename,
|
||||
arch, suffix, (const char *) NULL);
|
||||
else
|
||||
sprintf (string, "%s%s%s", search->name, slash, entry->filename);
|
||||
string = concat (search->name, slash, entry->filename,
|
||||
(const char *) 0);
|
||||
|
||||
if (ldfile_try_open_bfd (string, entry))
|
||||
{
|
||||
@ -429,7 +422,6 @@ static FILE *
|
||||
try_open (const char *name, const char *exten)
|
||||
{
|
||||
FILE *result;
|
||||
char buff[1000];
|
||||
|
||||
result = fopen (name, "r");
|
||||
|
||||
@ -446,7 +438,9 @@ try_open (const char *name, const char *exten)
|
||||
|
||||
if (*exten)
|
||||
{
|
||||
sprintf (buff, "%s%s", name, exten);
|
||||
char *buff;
|
||||
|
||||
buff = concat (name, exten, (const char *) NULL);
|
||||
result = fopen (buff, "r");
|
||||
|
||||
if (trace_file_tries)
|
||||
@ -456,6 +450,7 @@ try_open (const char *name, const char *exten)
|
||||
else
|
||||
info_msg (_("opened script file %s\n"), buff);
|
||||
}
|
||||
free (buff);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -469,7 +464,6 @@ ldfile_find_command_file (const char *name, const char *extend)
|
||||
{
|
||||
search_dirs_type *search;
|
||||
FILE *result;
|
||||
char buffer[1000];
|
||||
|
||||
/* First try raw name. */
|
||||
result = try_open (name, "");
|
||||
@ -478,9 +472,11 @@ ldfile_find_command_file (const char *name, const char *extend)
|
||||
/* Try now prefixes. */
|
||||
for (search = search_head; search != NULL; search = search->next)
|
||||
{
|
||||
sprintf (buffer, "%s%s%s", search->name, slash, name);
|
||||
char *buffer;
|
||||
|
||||
buffer = concat (search->name, slash, name, (const char *) NULL);
|
||||
result = try_open (buffer, extend);
|
||||
free (buffer);
|
||||
if (result)
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user