+2018-10-29 Alan Modra <amodra@gmail.com>
+
+ * ldmain.c (get_sysroot): Return "" for "--sysroot=/".
+
2018-10-29 Alan Modra <amodra@gmail.com>
* Makefile.am (ei386beos.c, ei386go32.c): Correct dependencies.
get_sysroot (int argc, char **argv)
{
int i;
- const char *path;
+ const char *path = NULL;
for (i = 1; i < argc; i++)
if (CONST_STRNEQ (argv[i], "--sysroot="))
- return argv[i] + strlen ("--sysroot=");
+ path = argv[i] + strlen ("--sysroot=");
- path = get_relative_sysroot (BINDIR);
- if (path)
- return path;
+ if (!path)
+ path = get_relative_sysroot (BINDIR);
- path = get_relative_sysroot (TOOLBINDIR);
- if (path)
- return path;
+ if (!path)
+ path = get_relative_sysroot (TOOLBINDIR);
+
+ if (!path)
+ path = TARGET_SYSTEM_ROOT;
+
+ if (IS_DIR_SEPARATOR (*path) && path[1] == 0)
+ path = "";
- return TARGET_SYSTEM_ROOT;
+ return path;
}
/* We need to find any explicitly given emulation in order to initialize the