]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Register --sysroot in the driver switches table
authorOlivier Hainque <hainque@adacore.com>
Mon, 20 Dec 2021 17:47:24 +0000 (17:47 +0000)
committerOlivier Hainque <hainque@adacore.com>
Tue, 4 Jan 2022 10:16:01 +0000 (10:16 +0000)
This change adjusts the processing of --sysroot to save the option in the
internal "switches" array, which lets self-specs test for it and provide a
default value possibly dependent on environment variables, as in

  --with-specs=%{!-sysroot*:--sysroot=%:getenv("WIND_BASE" /target)}

2021-12-20  Olivier Hainque  <hainque@adacore.com>

gcc/
* gcc.c (driver_handle_option): do_save --sysroot.

gcc/gcc.c

index e5c43b0bb1874fae0c0a17fe61339cb2a02c4461..d4c8746b0aa322286decf92aa72a12f0a393b655 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4492,7 +4492,9 @@ driver_handle_option (struct gcc_options *opts,
     case OPT__sysroot_:
       target_system_root = arg;
       target_system_root_changed = 1;
-      do_save = false;
+      /* Saving this option is useful to let self-specs decide to
+        provide a default one.  */
+      do_save = true;
       break;
 
     case OPT_time_: