Hello,

getenv_spec_function features code to return a fake
value for an undefined variable when we know that we
shouldn't complain about the variable being undefined
and that the variable value doesn't matter.

This code is there to prevent errors about undefined
variables referenced in specs when we're processing for
mere "--version" on the command line, for example.

The current code sets the value to the variable name.

We have a local configuration (for VxWorks, patch coming) where
%:getenv is used at the beginning of a STARTFILE_PREFIX_SPEC,
like:

  #define STARTFILE_PREFIX_SPEC "%:getenv(VSB_DIR /usr/lib/common)"

Now, for this spec we have a check that the value is an
absolute path, and gcc --version for this configuration then
complains with a message like:

   i586-wrs-vxworks7-gcc: fatal error: system path 'VSB_DIR/usr/lib/common' is 
not absolute

This patch fixes this glitch by simply prepending a '/' to
the fake value returned by getenv_spec_function for acceptable
undefined variables.

We have been using this in-house for months with gcc-7 on a wide
range of targets.

Bootstrapped and regression tested with mainline on x86_64-linux.

Ok to commit ?

Thanks in advance,

With Kind Regards,

Olivier

2018-06-22  Olivier Hainque  <hain...@adacore.com>

        * gcc.c (getenv_spec_function): Prepend '/' to value for allowed
        undefined variables.

Attachment: getenv-absolute-path.diff
Description: Binary data

Reply via email to