summaryrefslogtreecommitdiff
path: root/gcc/collect2.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-02 19:08:28 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-02 19:08:28 +0000
commitef6fd54f218dbfba4400c306a52638654cbd5b84 (patch)
tree61e3bda30c2e088b20ba314616e6fbb66afd9695 /gcc/collect2.c
parentcabc7147afe4990f585fd1eb83ea4f2c7f92b522 (diff)
downloadgcc-ef6fd54f218dbfba4400c306a52638654cbd5b84.tar.gz
gcc/
* collect2.c (target_system_root): New variable. (main): Handle --sysroot=. (ignore_library): Strip the sysroot from the library path. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148097 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r--gcc/collect2.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 660664dd29a..9848b903580 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -217,6 +217,14 @@ static char *response_file; /* Name of any current response file */
struct obstack temporary_obstack;
char * temporary_firstobj;
+/* A string that must be prepended to a target OS path in order to find
+ it on the host system. */
+#ifdef TARGET_SYSTEM_ROOT
+static const char *target_system_root = TARGET_SYSTEM_ROOT;
+#else
+static const char *target_system_root = "";
+#endif
+
/* Structure to hold all the directories in which to search for files to
execute. */
@@ -1224,6 +1232,8 @@ main (int argc, char **argv)
ld1--;
ld2--;
}
+ else if (strncmp (arg, "--sysroot=", 10) == 0)
+ target_system_root = arg + 10;
break;
}
}
@@ -2454,7 +2464,15 @@ static int
ignore_library (const char *name)
{
const char *const *p;
+ size_t length;
+ if (target_system_root[0] != '\0')
+ {
+ length = strlen (target_system_root);
+ if (strncmp (name, target_system_root, length) != 0)
+ return 0;
+ name += length;
+ }
for (p = &aix_std_libs[0]; *p != NULL; ++p)
if (strcmp (name, *p) == 0)
return 1;