Patch "selftests/bpf: Fix C++ compile error from missing _Bool type" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    selftests/bpf: Fix C++ compile error from missing _Bool type

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     selftests-bpf-fix-c-compile-error-from-missing-_bool.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ce0f9708c3fd333ce89806ba5656247c5c419c75
Author: Tony Ambardar <tony.ambardar@xxxxxxxxx>
Date:   Mon Jul 29 02:24:20 2024 -0700

    selftests/bpf: Fix C++ compile error from missing _Bool type
    
    [ Upstream commit aa95073fd290b5b3e45f067fa22bb25e59e1ff7c ]
    
    While building, bpftool makes a skeleton from test_core_extern.c, which
    itself includes <stdbool.h> and uses the 'bool' type. However, the skeleton
    test_core_extern.skel.h generated *does not* include <stdbool.h> or use the
    'bool' type, instead using the C-only '_Bool' type. Compiling test_cpp.cpp
    with g++ 12.3 for mips64el/musl-libc then fails with error:
    
      In file included from test_cpp.cpp:9:
      test_core_extern.skel.h:45:17: error: '_Bool' does not name a type
         45 |                 _Bool CONFIG_BOOL;
            |                 ^~~~~
    
    This was likely missed previously because glibc uses a GNU extension for
    <stdbool.h> with C++ (#define _Bool bool), not supported by musl libc.
    
    Normally, a C fragment would include <stdbool.h> and use the 'bool' type,
    and thus cleanly work after import by C++. The ideal fix would be for
    'bpftool gen skeleton' to output the correct type/include supporting C++,
    but in the meantime add a conditional define as above.
    
    Fixes: 7c8dce4b1661 ("bpftool: Make skeleton C code compilable with C++ compiler")
    Signed-off-by: Tony Ambardar <tony.ambardar@xxxxxxxxx>
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/6fc1dd28b8bda49e51e4f610bdc9d22f4455632d.1722244708.git.tony.ambardar@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/testing/selftests/bpf/test_cpp.cpp b/tools/testing/selftests/bpf/test_cpp.cpp
index dde0bb16e782e..abc2a56ab2616 100644
--- a/tools/testing/selftests/bpf/test_cpp.cpp
+++ b/tools/testing/selftests/bpf/test_cpp.cpp
@@ -6,6 +6,10 @@
 #include <bpf/libbpf.h>
 #include <bpf/bpf.h>
 #include <bpf/btf.h>
+
+#ifndef _Bool
+#define _Bool bool
+#endif
 #include "test_core_extern.skel.h"
 #include "struct_ops_module.skel.h"
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux