/* Main program of GNU linker.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002
+ 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
#endif
#endif
+#ifndef TARGET_SYSTEM_ROOT
+#define TARGET_SYSTEM_ROOT ""
+#endif
+
int main PARAMS ((int, char **));
static char *get_emulation PARAMS ((int, char **));
/* Name this program was invoked by. */
char *program_name;
+/* The prefix for system library directories. */
+char *ld_sysroot;
+
/* The file that we're creating. */
bfd *output_bfd = 0;
xatexit (remove_output);
+#ifdef TARGET_SYSTEM_ROOT_RELOCATABLE
+ ld_sysroot = make_relative_prefix (program_name, BINDIR,
+ TARGET_SYSTEM_ROOT);
+ if (ld_sysroot)
+ {
+ struct stat s;
+ int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode);
+ if (!res)
+ {
+ free (ld_sysroot);
+ ld_sysroot = TARGET_SYSTEM_ROOT;
+ }
+ }
+ else
+ ld_sysroot = TARGET_SYSTEM_ROOT;
+#else
+ ld_sysroot = TARGET_SYSTEM_ROOT;
+#endif
+
/* Set the default BFD target based on the configured target. Doing
this permits the linker to be configured for a particular target,
and linked against a shared BFD library which was configured for
link_info.traditional_format = FALSE;
link_info.optimize = FALSE;
link_info.no_undefined = FALSE;
- link_info.allow_shlib_undefined = FALSE;
+ link_info.allow_shlib_undefined = TRUE;
link_info.allow_multiple_definition = FALSE;
link_info.allow_undefined_version = TRUE;
link_info.keep_memory = TRUE;
else if (strcmp (argv[i], "-mips1") == 0
|| strcmp (argv[i], "-mips2") == 0
|| strcmp (argv[i], "-mips3") == 0
- || strcmp (argv[i], "-mips32") == 0
- || strcmp (argv[i], "-mips64") == 0
|| strcmp (argv[i], "-mips4") == 0
- || strcmp (argv[i], "-mips5") == 0)
+ || strcmp (argv[i], "-mips5") == 0
+ || strcmp (argv[i], "-mips32") == 0
+ || strcmp (argv[i], "-mips32r2") == 0
+ || strcmp (argv[i], "-mips64") == 0)
{
/* FIXME: The arguments -mips1, -mips2, -mips3, etc. are
passed to the linker by some MIPS compilers. They
Libraries will be searched for here too, but that's ok.
We look for the "ldscripts" directory in:
+ SCRIPTDIR (passed from Makefile)
+ (adjusted according to the current location of the binary)
SCRIPTDIR (passed from Makefile)
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) */
+ the dir where this program is/../lib
+ (for installing the tool suite elsewhere) */
static void
set_scripts_dir ()
char *end, *dir;
size_t dirlen;
+ dir = make_relative_prefix (program_name, BINDIR, SCRIPTDIR);
+ if (dir && check_for_scripts_dir (dir))
+ /* Success. Don't free dir. */
+ return;
+
+ if (dir)
+ free (dir);
+
if (check_for_scripts_dir (SCRIPTDIR))
/* We've been installed normally. */
return;