Message ID | 4F2024FC.8060200@ubuntu.com |
---|---|
State | New |
Headers | show |
On Wed, 25 Jan 2012, Matthias Klose wrote: > This can end up in generation for dependency files, and other files parsing > the output. The solution I came up with is to check for sysroot set to '/' and > special case this in two places. Afaics, there are no other places. I could imagine a sysroot path that isn't just '/' but ends with '/' resulting in duplicate '/' in the middle of the path - although that's not a correctness issue in the way that '//' at the start could be, maybe the best check is actually for '/' at end of sysroot (in which case skip the '/' at the start of the path within the sysroot)? Or remove such a '/' at end of sysroot at configure time rather than checking for it later....
Index: gcc/incpath.c =================================================================== --- gcc/incpath.c (revision 183421) +++ gcc/incpath.c (working copy) @@ -166,7 +166,10 @@ /* Should this directory start with the sysroot? */ if (sysroot && p->add_sysroot) - str = concat (sysroot, p->fname, NULL); + if (IS_DIR_SEPARATOR (*sysroot) && sysroot[1] == '\0') + str = concat (p->fname, NULL); + else + str = concat (sysroot, p->fname, NULL); else if (!p->add_sysroot && relocated && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len)) { Index: gcc/gcc.c =================================================================== --- gcc/gcc.c (revision 183421) +++ gcc/gcc.c (working copy) @@ -2443,7 +2443,9 @@ if (!IS_ABSOLUTE_PATH (prefix)) fatal_error ("system path %qs is not absolute", prefix); - if (target_system_root) + if (target_system_root + && !IS_DIR_SEPARATOR (*target_system_root) + && target_system_root[1] != '\0') { if (target_sysroot_suffix) prefix = concat (target_sysroot_suffix, prefix, NULL);