public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Register --sysroot in the driver switches table
@ 2021-12-20 21:28 Olivier Hainque
  2021-12-28 16:38 ` Jeff Law
  2022-01-05  7:45 ` Martin Liška
  0 siblings, 2 replies; 8+ messages in thread
From: Olivier Hainque @ 2021-12-20 21:28 UTC (permalink / raw)
  To: gcc-patches; +Cc: hainque, rv

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

Hello,

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)}

This helps the use we have of self specs for VxWorks, and
was bootstrapped and regression tested on native 64bit linux.

Ok to commit ?

Thanks in advance,

With Kind Regards,

Olivier


[-- Attachment #2: 0001-Register-sysroot-in-the-driver-switches-table.patch --]
[-- Type: text/x-diff, Size: 1158 bytes --]

From 964829ee06ffe1bedcbab6a3b4c92c5d161aaaed Mon Sep 17 00:00:00 2001
From: Olivier Hainque <hainque@adacore.com>
Date: Mon, 20 Dec 2021 17:47:24 +0000
Subject: [PATCH] Register --sysroot in the driver switches table

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 b75b50b87b2..beb37fe980e 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4488,7 +4488,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.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-10 17:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 21:28 [PATCH] Register --sysroot in the driver switches table Olivier Hainque
2021-12-28 16:38 ` Jeff Law
2021-12-30 20:42   ` Olivier Hainque
2022-01-05  7:45 ` Martin Liška
2022-01-05  9:26   ` Olivier Hainque
2022-01-05 17:57     ` Olivier Hainque
2022-01-10  8:00       ` Richard Biener
2022-01-10 17:18         ` Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).