aboutsummaryrefslogtreecommitdiff
path: root/ld/ldmain.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r--ld/ldmain.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c
index b6914db..6527613 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -228,7 +228,14 @@ main (int argc, char **argv)
if (*ld_sysroot)
ld_canon_sysroot = lrealpath (ld_sysroot);
if (ld_canon_sysroot)
- ld_canon_sysroot_len = strlen (ld_canon_sysroot);
+ {
+ ld_canon_sysroot_len = strlen (ld_canon_sysroot);
+
+ /* is_sysrooted_pathname() relies on no trailing dirsep. */
+ if (ld_canon_sysroot_len > 0
+ && IS_DIR_SEPARATOR (ld_canon_sysroot [ld_canon_sysroot_len - 1]))
+ ld_canon_sysroot [--ld_canon_sysroot_len] = '\0';
+ }
else
ld_canon_sysroot_len = -1;