public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Olivier Hainque <hainque@adacore.com>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: Olivier Hainque <hainque@adacore.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Jerome Guitton <guitton@adacore.com>
Subject: Re: [PATCH] Leverage sysroot for VxWorks
Date: Mon, 20 Dec 2021 17:29:01 +0100	[thread overview]
Message-ID: <6BC37A05-8783-4E17-81B1-E6DCDCD8B2B0@adacore.com> (raw)
In-Reply-To: <33ac9e6c-b849-16a4-73e1-b905ad6ea378@prevas.dk>

Hi Rasmus,

> On 20 Dec 2021, at 12:40, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:
> 
> On 10/12/2021 19.24, Olivier Hainque wrote:
> 
>> For the toolchains we build, this is achieved with a few
>> configure options like:
>> 
>>   --with-sysroot
>>   --with-build-sysroot=${WIND_BASE}/target
> 
> So forward-porting our private patches up until
> 
> 7bf710b5116 - libstdc++: Add support for '?' in linker script globs
> 
> (i.e. the commit before this one) went without problems, with no changes
> required in our build scripts. Then when rebasing to this one, now known as
> 
> f3f923e5139 - Leverage sysroot for VxWorks
> 
> the build broke as expected because I'd been using somewhat different
> values of --with(-build)-sysroot. However, changing those configure
> options as indicated above again produced a working toolchain, so this
> is all good.

Great !

>>  --with-specs=%{!sysroot=*:--sysroot=%:getenv(WIND_BASE /target)}
> 
> However, I'm a little confused about the purpose of this one.

> First,
> shouldn't this be '%{!-sysroot=*....}', i.e. with a leading dash, since
> the option is --sysroot ? But whether I use one or the other, it seems
> that the resulting compiler ignores a --sysroot argument; if I
> explicitly unexport WIND_BASE and manually add a --sysroot argument that
> should have the same effect as above, gcc fails with WIND_BASE not defined:

> The specs syntax doesn't explicitly list the negative form of %{S*:X},
> and I can't find any in-tree examples (though it's rather hard to grep
> for), so I don't even know if this is supposed to work.

I think it is, and it is used for example in:

  config/i386/i386.h:  {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" },  \

> It's not a big deal, we can just continue to define and export
> WIND_BASE, but it's probably best for long-term maintenance if our build
> scripts and configure options are aligned with what you do on your end,
> so I would just like to understand this fully.

Sure, appreciated.

The purpose was indeed to also prevent producing the default option
if one is there already, and you are right that the form above doesn't
work as expected on this account.

I had made a couple of basic tests and thought it did, but must have
made a mistake. Might have been skewed by an implicit conviction.

The reason for which it doesn't work is the do_save = false in
driver_handle_option for --sysroot:

   case OPT__sysroot_:
      target_system_root = arg;
      target_system_root_changed = 1;
      do_save = false;
      break;


Changing that has the intended effect on our use case,
with an additional dash indeed.

I'll test further and propose the change if it doesn't raise
unexpected problems. We could also even consider using DRIVER_SELF_SPECS
then.

Thanks for your feedback,

Olivier








      reply	other threads:[~2021-12-20 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10 18:24 Olivier Hainque
2021-12-20 11:40 ` Rasmus Villemoes
2021-12-20 16:29   ` Olivier Hainque [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6BC37A05-8783-4E17-81B1-E6DCDCD8B2B0@adacore.com \
    --to=hainque@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=guitton@adacore.com \
    --cc=rasmus.villemoes@prevas.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).