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

* Re: [PATCH] Register --sysroot in the driver switches table
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Jeff Law @ 2021-12-28 16:38 UTC (permalink / raw)
  To: Olivier Hainque, gcc-patches; +Cc: rv



On 12/20/2021 2:28 PM, Olivier Hainque via Gcc-patches wrote:
> 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
>
>
> 0001-Register-sysroot-in-the-driver-switches-table.patch
>
>  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.
OK.

jeff


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

* Re: [PATCH] Register --sysroot in the driver switches table
  2021-12-28 16:38 ` Jeff Law
@ 2021-12-30 20:42   ` Olivier Hainque
  0 siblings, 0 replies; 8+ messages in thread
From: Olivier Hainque @ 2021-12-30 20:42 UTC (permalink / raw)
  To: Jeff Law; +Cc: Olivier Hainque, gcc-patches, rv



> On 28 Dec 2021, at 17:38, Jeff Law <jeffreyalaw@gmail.com> wrote:

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


Thanks for the prompt review Jeff!

I have another simple one coming :)


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

* Re: [PATCH] Register --sysroot in the driver switches table
  2021-12-20 21:28 [PATCH] Register --sysroot in the driver switches table Olivier Hainque
  2021-12-28 16:38 ` Jeff Law
@ 2022-01-05  7:45 ` Martin Liška
  2022-01-05  9:26   ` Olivier Hainque
  1 sibling, 1 reply; 8+ messages in thread
From: Martin Liška @ 2022-01-05  7:45 UTC (permalink / raw)
  To: Olivier Hainque, gcc-patches; +Cc: rv

On 12/20/21 22:28, Olivier Hainque via Gcc-patches wrote:
> 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
> 

Hello.

I think the patch broke my cross-rx-gcc12 package, failing now with:

[  162s] checking for rx-elf-gcc... /home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux/./gcc/xgcc -B/home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux/./gcc/ -B/usr/rx-elf/bin/ -B/usr/rx-elf/lib/ -isystem /usr/rx-elf/include -isystem /usr/rx-elf/sys-include --sysroot=/usr/rx-elf/sys-root
[  162s] checking for suffix of object files... configure: error: in `/home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux/rx-elf/libgcc':
[  162s] configure: error: cannot compute suffix of object files: cannot compile
[  162s] See `config.log' for more details
[  162s] make[1]: *** [Makefile:12902: configure-target-libgcc] Error 1
[  162s] make[1]: *** Waiting for unfinished jobs....
[  162s] g++ -static-libstdc++ -static-libgcc   -o g++-mapper-server server.o resolver.o ../libcody/libcody.a ../libiberty/libiberty.a
[  162s] /usr/bin/install -c g++-mapper-server ../gcc/g++-mapper-server
[  162s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux/c++tools'
[  162s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux'
[  162s] make: *** [Makefile:1027: all] Error 2
[  162s] error: Bad exit status from /var/tmp/rpm-tmp.wDOIGP (%build)

configure:3566: /home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux/./gcc/xgcc -B/home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux/./gcc/ -B/usr/rx-elf/bin/ -B/usr/rx-elf/lib/ -isystem /usr/rx-elf/include -isystem /usr/rx-elf/sys-include --sysroot=/usr/rx-elf/sys-root   -o conftest -g -O2   conftest.c  >&5
xgcc: error: unrecognized command-line option '--sysroot=/usr/rx-elf/sys-root'
configure:3569: $? = 1

The compiler is configured with:

[   21s] + ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++ --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/12 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ '--with-pkgversion=SUSE Linux' --with-slibdir=/usr/rx-elf/sys-root/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-12 --program-prefix=rx-elf- --target=rx-elf --disable-nls --with-sysroot=/usr/rx-elf/sys-root --with-build-sysroot=/usr/rx-elf/sys-root --with-build-time-tools=/usr/rx-elf/bin --with-newlib --disable-libsanitizer --build=x86_64-suse-linux --host=x86_64-suse-linux

Can you please take a look?

Cheers,
Martin

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

* Re: [PATCH] Register --sysroot in the driver switches table
  2022-01-05  7:45 ` Martin Liška
@ 2022-01-05  9:26   ` Olivier Hainque
  2022-01-05 17:57     ` Olivier Hainque
  0 siblings, 1 reply; 8+ messages in thread
From: Olivier Hainque @ 2022-01-05  9:26 UTC (permalink / raw)
  To: Martin Liška; +Cc: Olivier Hainque, gcc-patches, rv

Hi Martin,

> On 5 Jan 2022, at 08:45, Martin Liška <mliska@suse.cz> wrote:
> 
> On 12/20/21 22:28, Olivier Hainque via Gcc-patches wrote:

> I think the patch broke my cross-rx-gcc12 package, failing now with:

> configure: error: in `/home/abuild/rpmbuild/BUILD/gcc-12.0.0+git190624/obj-x86_64-suse-linux/rx-elf/libgcc':

> xgcc: error: unrecognized command-line option '--sysroot=/usr/rx-elf/sys-root'
> 
> The compiler is configured with:
> 
> [   21s] + ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++ --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/12 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --disable-plugin --with-bugurl=https://bugs.opensuse.org/ '--with-pkgversion=SUSE Linux' --with-slibdir=/usr/rx-elf/sys-root/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-12 --program-prefix=rx-elf- --target=rx-elf --disable-nls --with-sysroot=/usr/rx-elf/sys-root --with-build-sysroot=/usr/rx-elf/sys-root --with-build-time-tools=/usr/rx-elf/bin --with-newlib --disable-libsanitizer --build=x86_64-suse-linux --host=x86_64-suse-linux
> 
> Can you please take a look?

Sure. Thanks for reporting the failure. Sorry for the breakage.

The change should also set "validated" true 
when requesting to save --sysroot.

I'm not sure why we don't see the problem with our vxworks
setup - double checked again this morning, we do have successful
builds passing --sysroot to the driver when configuring various
libraries.

Testing the patch further ...




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

* Re: [PATCH] Register --sysroot in the driver switches table
  2022-01-05  9:26   ` Olivier Hainque
@ 2022-01-05 17:57     ` Olivier Hainque
  2022-01-10  8:00       ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Olivier Hainque @ 2022-01-05 17:57 UTC (permalink / raw)
  To: Martin Liška
  Cc: Olivier Hainque, gcc-patches, Rasmus Villemoes, Jeff Law

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



> On 5 Jan 2022, at 10:26, Olivier Hainque <hainque@adacore.com> wrote:
> 
> The change should also set "validated" true 
> when requesting to save --sysroot.

The attached adjustment fixes the failure I could reproduce,
bootstraps and regtests fine on x86_64-linux, and passes a build
+ a couple of in-house testsuites for one of our vxworks ports.

Ok to commit?

Thanks in advance,

Olivier

2022-01-05  Olivier Hainque  <hainque@adacore.com>

	* gcc.c (driver_handle_option): State --sysroot as
	validated.


[-- Attachment #2: 0001-State-sysroot-option-as-validated-once-processed.patch --]
[-- Type: application/octet-stream, Size: 990 bytes --]

From 5b35d59e236519b7934e22ea7fd857ccf536eec7 Mon Sep 17 00:00:00 2001
From: Olivier Hainque <hainque@adacore.com>
Date: Wed, 5 Jan 2022 09:07:33 +0000
Subject: [PATCH] State --sysroot option as validated once processed

Since we now save the option in the "switches" table
to let specs use it more generally, we need to explicitly
state that the option was validated else the driver
will consider it "unrecognized".

2022-01-05  Olivier Hainque  <hainque@adacore.com>

	* gcc.c (driver_handle_option): State --sysroot as
	validated.
---
 gcc/gcc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index d4c8746b0aa..29fa0f7ddce 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -4495,6 +4495,7 @@ driver_handle_option (struct gcc_options *opts,
       /* Saving this option is useful to let self-specs decide to
 	 provide a default one.  */
       do_save = true;
+      validated = true;
       break;
 
     case OPT_time_:
-- 
2.25.1


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

* Re: [PATCH] Register --sysroot in the driver switches table
  2022-01-05 17:57     ` Olivier Hainque
@ 2022-01-10  8:00       ` Richard Biener
  2022-01-10 17:18         ` Olivier Hainque
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Biener @ 2022-01-10  8:00 UTC (permalink / raw)
  To: Olivier Hainque
  Cc: Martin Liška, Rasmus Villemoes, gcc-patches, Jeff Law

On Wed, Jan 5, 2022 at 6:58 PM Olivier Hainque via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
>
> > On 5 Jan 2022, at 10:26, Olivier Hainque <hainque@adacore.com> wrote:
> >
> > The change should also set "validated" true
> > when requesting to save --sysroot.
>
> The attached adjustment fixes the failure I could reproduce,
> bootstraps and regtests fine on x86_64-linux, and passes a build
> + a couple of in-house testsuites for one of our vxworks ports.
>
> Ok to commit?

OK.

Thanks,
Richard.

> Thanks in advance,
>
> Olivier
>
> 2022-01-05  Olivier Hainque  <hainque@adacore.com>
>
>         * gcc.c (driver_handle_option): State --sysroot as
>         validated.
>

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

* Re: [PATCH] Register --sysroot in the driver switches table
  2022-01-10  8:00       ` Richard Biener
@ 2022-01-10 17:18         ` Olivier Hainque
  0 siblings, 0 replies; 8+ messages in thread
From: Olivier Hainque @ 2022-01-10 17:18 UTC (permalink / raw)
  To: Richard Biener
  Cc: Olivier Hainque, Martin Liška, Rasmus Villemoes,
	gcc-patches, Jeff Law



> On 10 Jan 2022, at 09:00, Richard Biener <richard.guenther@gmail.com> wrote:
> 
> On Wed, Jan 5, 2022 at 6:58 PM Olivier Hainque via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>> 
>> 
>> 
>>> On 5 Jan 2022, at 10:26, Olivier Hainque <hainque@adacore.com> wrote:
>>> 
>>> The change should also set "validated" true
>>> when requesting to save --sysroot.
>> 
>> The attached adjustment fixes the failure I could reproduce,
>> bootstraps and regtests fine on x86_64-linux, and passes a build
>> + a couple of in-house testsuites for one of our vxworks ports.
>> 
>> Ok to commit?
> 
> OK.

Great, thanks Richard :)



^ 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).