summaryrefslogtreecommitdiff
path: root/0041-Backport-Register-sysroot-in-the-driver-switches-tab.patch
blob: 441b5c5afd5789f77ad62563686585c584286c5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From beeb0fb50c7e40ee3d79044abc6408f760d6584a Mon Sep 17 00:00:00 2001
From: zhaowenyu <804544223@qq.com>
Date: Thu, 23 Jun 2022 10:40:46 +0800
Subject: [PATCH 07/12] [Backport] Register --sysroot in the driver switches
 table

Reference: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=48e2d9b7b88dabed336cd098cd212d0e53c5125f

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index b55075b14..655beffcc 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4190,7 +4190,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_:
-- 
2.27.0.windows.1