mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-31 05:44:41 +08:00
PR ld/10047
* ldfile.c (find_scripts_dir): Use make_relative_prefix to find ldscripts in build tree. Don't repeat search for ../lib/ldscripts.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2009-04-14 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
PR ld/10047
|
||||||
|
* ldfile.c (find_scripts_dir): Use make_relative_prefix to find
|
||||||
|
ldscripts in build tree. Don't repeat search for ../lib/ldscripts.
|
||||||
|
|
||||||
2009-04-13 H.J. Lu <hongjiu.lu@intel.com>
|
2009-04-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* ldfile.c (ldfile_find_command_file): Revert the last change.
|
* ldfile.c (ldfile_find_command_file): Revert the last change.
|
||||||
|
40
ld/ldfile.c
40
ld/ldfile.c
@ -1,6 +1,6 @@
|
|||||||
/* Linker file opening and searching.
|
/* Linker file opening and searching.
|
||||||
Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002,
|
Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002,
|
||||||
2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of the GNU Binutils.
|
This file is part of the GNU Binutils.
|
||||||
|
|
||||||
@ -477,15 +477,12 @@ check_for_scripts_dir (char *dir)
|
|||||||
SCRIPTDIR (passed from Makefile)
|
SCRIPTDIR (passed from Makefile)
|
||||||
(adjusted according to the current location of the binary)
|
(adjusted according to the current location of the binary)
|
||||||
SCRIPTDIR (passed from Makefile)
|
SCRIPTDIR (passed from Makefile)
|
||||||
the dir where this program is (for using it from the build tree)
|
the dir where this program is (for using it from the build tree). */
|
||||||
the dir where this program is/../lib
|
|
||||||
(for installing the tool suite elsewhere). */
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
find_scripts_dir (void)
|
find_scripts_dir (void)
|
||||||
{
|
{
|
||||||
char *end, *dir;
|
char *dir;
|
||||||
size_t dirlen;
|
|
||||||
|
|
||||||
dir = make_relative_prefix (program_name, BINDIR, SCRIPTDIR);
|
dir = make_relative_prefix (program_name, BINDIR, SCRIPTDIR);
|
||||||
if (dir)
|
if (dir)
|
||||||
@ -508,37 +505,14 @@ find_scripts_dir (void)
|
|||||||
return SCRIPTDIR;
|
return SCRIPTDIR;
|
||||||
|
|
||||||
/* Look for "ldscripts" in the dir where our binary is. */
|
/* Look for "ldscripts" in the dir where our binary is. */
|
||||||
end = strrchr (program_name, '/');
|
dir = make_relative_prefix (program_name, ".", ".");
|
||||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
if (dir)
|
||||||
{
|
{
|
||||||
/* We could have \foo\bar, or /foo\bar. */
|
|
||||||
char *bslash = strrchr (program_name, '\\');
|
|
||||||
|
|
||||||
if (end == NULL || (bslash != NULL && bslash > end))
|
|
||||||
end = bslash;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (end == NULL)
|
|
||||||
/* Don't look for ldscripts in the current directory. There is
|
|
||||||
too much potential for confusion. */
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
dirlen = end - program_name;
|
|
||||||
/* Make a copy of program_name in dir.
|
|
||||||
Leave room for later "/../lib". */
|
|
||||||
dir = xmalloc (dirlen + sizeof ("/../lib"));
|
|
||||||
strncpy (dir, program_name, dirlen);
|
|
||||||
dir[dirlen] = '\0';
|
|
||||||
|
|
||||||
if (check_for_scripts_dir (dir))
|
|
||||||
return dir;
|
|
||||||
|
|
||||||
/* Look for "ldscripts" in <the dir where our binary is>/../lib. */
|
|
||||||
strcpy (dir + dirlen, "/../lib");
|
|
||||||
if (check_for_scripts_dir (dir))
|
if (check_for_scripts_dir (dir))
|
||||||
return dir;
|
return dir;
|
||||||
free (dir);
|
free (dir);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user