https://gcc.gnu.org/g:995d1c2b7cca9bec23a60f9cbcebccd9f307c53f

commit r15-6514-g995d1c2b7cca9bec23a60f9cbcebccd9f307c53f
Author: Jose E. Marchesi <jose.march...@oracle.com>
Date:   Fri Jan 3 13:42:26 2025 +0100

    bpf: install a wrapping stdint.h for bpf-none-unknown targets
    
    This patch makes GCC to wrap the host's stdint.h header when operating
    in the default hosted/non-freestanding mode.  It is thus up to the
    user to provide a suitable standard header unless -ffreestanding gets
    explicitly passed in the compilation line.
    
    A few tests that use stdint.h are adapted to explicitly pass
    -ffreestanding.
    
    Tested in a x86_64-linux-gnu host with target bpf-unknown-none.
    
    gcc/ChangeLog:
    
            * config.gcc: install a wrapping stdint.h in bpf targets.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/bpf/diag-funargs-2.c: Use -ffreestanding.
            * gcc.target/bpf/helper-skb-ancestor-cgroup-id.c: Likewise.
            * gcc.target/bpf/helper-bind.c: Likewise.
            * gcc.target/bpf/diag-funargs-3.c: Likewise.

Diff:
---
 gcc/config.gcc                                               | 2 +-
 gcc/testsuite/gcc.target/bpf/diag-funargs-2.c                | 2 +-
 gcc/testsuite/gcc.target/bpf/diag-funargs-3.c                | 2 +-
 gcc/testsuite/gcc.target/bpf/helper-bind.c                   | 2 +-
 gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index c01473550872..55e37146ee03 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1690,7 +1690,7 @@ bpf-*-*)
         tm_file="elfos.h ${tm_file}"
         tmake_file="${tmake_file} bpf/t-bpf"
         use_collect2=no
-        use_gcc_stdint=provide
+        use_gcc_stdint=wrap
         extra_objs="btfext-out.o core-builtins.o"
         target_gtfiles="$target_gtfiles \$(srcdir)/config/bpf/btfext-out.cc 
\$(srcdir)/config/bpf/core-builtins.cc"
         ;;
diff --git a/gcc/testsuite/gcc.target/bpf/diag-funargs-2.c 
b/gcc/testsuite/gcc.target/bpf/diag-funargs-2.c
index 116f1bc849db..c4c89b6dad3c 100644
--- a/gcc/testsuite/gcc.target/bpf/diag-funargs-2.c
+++ b/gcc/testsuite/gcc.target/bpf/diag-funargs-2.c
@@ -1,7 +1,7 @@
 /* Verify proper errors are generated for functions taking too many
    arguments, with aggregates and 128-bit arguments.  */
 /* { dg-do compile } */
-/* { dg-options "-O0" } */
+/* { dg-options "-O0 -ffreestanding" } */
 
 #include <stdint.h>
 
diff --git a/gcc/testsuite/gcc.target/bpf/diag-funargs-3.c 
b/gcc/testsuite/gcc.target/bpf/diag-funargs-3.c
index 598a9dbeb4b1..9106d4f6edd0 100644
--- a/gcc/testsuite/gcc.target/bpf/diag-funargs-3.c
+++ b/gcc/testsuite/gcc.target/bpf/diag-funargs-3.c
@@ -1,7 +1,7 @@
 /* Verify proper errors are generated for functions taking too many
    arguments, with aggregates and 128-bit arguments.  */
 /* { dg-do compile } */
-/* { dg-options "-O0" } */
+/* { dg-options "-O0 -ffreestanding" } */
 
 #include <stdint.h>
 
diff --git a/gcc/testsuite/gcc.target/bpf/helper-bind.c 
b/gcc/testsuite/gcc.target/bpf/helper-bind.c
index 53514ba32333..3b20edc2b6af 100644
--- a/gcc/testsuite/gcc.target/bpf/helper-bind.c
+++ b/gcc/testsuite/gcc.target/bpf/helper-bind.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
+/* { dg-options "-std=gnu99 -ffreestanding" } */
 
 #include <stdint.h>
 
diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c 
b/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c
index 075dbe6f852d..a6505d458402 100644
--- a/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-std=gnu99 -O2 -ffreestanding" } */
 
 #include <stdint.h>

Reply via email to