]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Check for sysconf decl on vxworks
authorAlexandre Oliva <oliva@adacore.com>
Wed, 24 May 2023 06:07:41 +0000 (03:07 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Wed, 24 May 2023 06:07:41 +0000 (03:07 -0300)
The sysconf function is only available in rtp mode on vxworks.  In
kernel mode, it is not even declared, but the feature test macro in
the testsuite doesn't notice its absence because it's a link test, and
vxworks kernel mode uses partial linking.

This patch introduces an alternate test on vxworks targets to check
for a declaration and for an often-used sysconf parameter.

for  gcc/testsuite/ChangeLog

* lib/target-supports.exp (check_effective_target_sysconf):
Check for declaration and _SC_PAGESIZE on vxworks.

gcc/testsuite/lib/target-supports.exp

index bd9f432e4a7619f61e5f63f179b13a02922292f4..263ef35a2e4df7f7b934af8e0c941e36ce891d3f 100644 (file)
@@ -1146,6 +1146,17 @@ proc check_effective_target_mmap {} {
 # Return 1 if the target supports sysconf, 0 otherwise.
 
 proc check_effective_target_sysconf {} {
+    # VxWorks has sysconf in rtp mode only, but our way to test can't
+    # tell kernel mode doesn't, as we're doing partial links for
+    # kernel modules.  We can tell by checking for a declaration, or
+    # for some sysconf parm, because configurations that don't offer
+    # sysconf don't have either.
+    if { [istarget *-*-vxworks*] } {
+       return [check_no_compiler_messages sysconfdecl assembly {
+           #include <unistd.h>
+           int f() { return sysconf(_SC_PAGESIZE); }
+       }];
+    }
     return [check_function_available "sysconf"]
 }