]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bpf: install a wrapping stdint.h for bpf-none-unknown targets
authorJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 3 Jan 2025 12:42:26 +0000 (13:42 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 3 Jan 2025 12:42:26 +0000 (13:42 +0100)
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.

gcc/config.gcc
gcc/testsuite/gcc.target/bpf/diag-funargs-2.c
gcc/testsuite/gcc.target/bpf/diag-funargs-3.c
gcc/testsuite/gcc.target/bpf/helper-bind.c
gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c

index c01473550872cbc92efea12d49768d371394fc48..55e37146ee0356b67b8a1a09d263eccdf69cd91a 100644 (file)
@@ -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"
         ;;
index 116f1bc849dbbdfcf85e6389c25c0985bd50f588..c4c89b6dad3c727f5254f79b1d05449350bc2aa4 100644 (file)
@@ -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>
 
index 598a9dbeb4b11feac232bee01c502fc515617908..9106d4f6edd0def084679f9a4a7b93929c06609a 100644 (file)
@@ -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>
 
index 53514ba32333bec1ccba81f48cae2355a8a8e3b5..3b20edc2b6aff846b491a732749d0ef9fdd78292 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-std=gnu99" } */
+/* { dg-options "-std=gnu99 -ffreestanding" } */
 
 #include <stdint.h>
 
index 075dbe6f852d4c0443aa56aa693cd5e1914391f1..a6505d45840234cd49db39c4625c0d48c25b48de 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-std=gnu99 -O2" } */
+/* { dg-options "-std=gnu99 -O2 -ffreestanding" } */
 
 #include <stdint.h>