[PATCH] vxworks: Fix GCC selftests for *-wrs-vxworks7-* targets
Iain Buclaw
ibuclaw@gdcproject.org
Wed Aug 19 12:17:53 GMT 2020
Excerpts from Olivier Hainque's message of August 18, 2020 2:25 pm:
> Hi Iain,
>
>> On 18 Aug 2020, at 13:45, Iain Buclaw <ibuclaw@gdcproject.org> wrote:
>>
>> Attached is the change as per your proposal.
>>
>> * config/vxworks.h (VXWORKS_ADDITIONAL_CPP_SPEC): Replace -nostdinc
>> with -fself-tests.
>> #undef VXWORKS_ADDITIONAL_CPP_SPEC
>> #define VXWORKS_ADDITIONAL_CPP_SPEC \
>> - "%{!nostdinc: \
>> + "%{!fself-test=*: \
>> %{isystem*} \
>> %{mrtp: -idirafter %:getenv(VSB_DIR /h) \
>> -idirafter %:getenv(VSB_DIR /share/h) \
>> @@ -55,7 +60,7 @@ along with GCC; see the file COPYING3. If not see
>>
>> #undef VXWORKS_ADDITIONAL_CPP_SPEC
>> #define VXWORKS_ADDITIONAL_CPP_SPEC \
>> - "%{!nostdinc: \
>> + "%{!fself-test=*: \
>
> Thanks for the updated proposal.
>
> Sorry, I have been unclear: If I'm reading the spec of
> -nostdinc correctly, I think we should still prevent those
> CPP switches from being added if the option is provided.
>
Ah, no worries, attached updated patch.
> Can you please amend just this part to prevent the addition
> of the following switches if either -nostdinc or -fself-test
> is provided ?
>
> Ok, for me with this change, assuming -nostdinc in
> SELFTEST_FLAGS didn't have other uses than the one documented
> in the attached comment (I'm not familiar enough with the
> self-tests to know for sure).
>
The introducing commit is cf7bb33f4d9532dc7ea2551acbf888341b8f12ce, the
reliance on -nostdinc might have changed in the meantime though.
[Update]
As we have discussed this off the lists though, we agreed to compromise
and leave -nostdinc as it is in SELFTEST_FLAGS.
Iain.
---
gcc/ChangeLog:
* config/vxworks.h (VXWORKS_ADDITIONAL_CPP_SPEC): Don't include
VxWorks header files if -fself-tests is used.
(STARTFILE_PREFIX_SPEC): Avoid using VSB_DIR if -fself-tests is used.
---
diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index d648d2f23cb..e50260b08e4 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -36,11 +36,16 @@ along with GCC; see the file COPYING3. If not see
/* Since we provide a default -isystem, expand -isystem on the command
line early. */
+
+/* Self-tests may be run in contexts where the VxWorks environment isn't
+ available. Prevent attempts at designating the location of runtime header
+ files, libraries or startfiles, which would fail on unset environment
+ variables and aren't needed for such tests. */
#if TARGET_VXWORKS7
#undef VXWORKS_ADDITIONAL_CPP_SPEC
#define VXWORKS_ADDITIONAL_CPP_SPEC \
- "%{!nostdinc: \
+ "%{!nostdinc:%{!fself-test=*: \
%{isystem*} \
%{mrtp: -idirafter %:getenv(VSB_DIR /h) \
-idirafter %:getenv(VSB_DIR /share/h) \
@@ -49,19 +54,19 @@ along with GCC; see the file COPYING3. If not see
;: -idirafter %:getenv(VSB_DIR /h) \
-idirafter %:getenv(VSB_DIR /share/h) \
-idirafter %:getenv(VSB_DIR /krnl/h/system) \
- -idirafter %:getenv(VSB_DIR /krnl/h/public)}}"
+ -idirafter %:getenv(VSB_DIR /krnl/h/public)}}}"
#else /* TARGET_VXWORKS7 */
#undef VXWORKS_ADDITIONAL_CPP_SPEC
#define VXWORKS_ADDITIONAL_CPP_SPEC \
- "%{!nostdinc: \
+ "%{!nostdinc:%{!fself-test=*: \
%{isystem*} \
%{mrtp: -idirafter %:getenv(WIND_USR /h) \
-idirafter %:getenv(WIND_USR /h/wrn/coreip) \
;: -idirafter %:getenv(WIND_BASE /target/h) \
-idirafter %:getenv(WIND_BASE /target/h/wrn/coreip) \
-}}"
+}}}"
#endif
@@ -108,7 +113,8 @@ along with GCC; see the file COPYING3. If not see
#if TARGET_VXWORKS7
#undef STARTFILE_PREFIX_SPEC
-#define STARTFILE_PREFIX_SPEC "%:getenv(VSB_DIR /usr/lib/common)"
+#define STARTFILE_PREFIX_SPEC \
+ "%{!fself-test=*:%:getenv(VSB_DIR /usr/lib/common)}"
#define TLS_SYM "-u __tls__"
#else
#define TLS_SYM ""
More information about the Gcc-patches
mailing list