diff options
Diffstat (limited to 'tools/build/feature')
-rw-r--r-- | tools/build/feature/Makefile | 15 | ||||
-rw-r--r-- | tools/build/feature/test-all.c | 5 | ||||
-rw-r--r-- | tools/build/feature/test-cxa-demangle.cpp | 17 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf-bpf_map_create.c | 8 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf-bpf_object__next_map.c | 8 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf-bpf_object__next_program.c | 8 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf-bpf_prog_load.c | 9 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf-bpf_program__set_insns.c | 8 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c | 8 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf-btf__raw_data.c | 8 | ||||
-rw-r--r-- | tools/build/feature/test-libbpf.c | 4 | ||||
-rw-r--r-- | tools/build/feature/test-scandirat.c | 13 |
12 files changed, 47 insertions, 64 deletions
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 690fe97be190..0f0aa9b7d7b5 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -23,6 +23,7 @@ FILES= \ test-libbfd-liberty.bin \ test-libbfd-liberty-z.bin \ test-cplus-demangle.bin \ + test-cxa-demangle.bin \ test-libcap.bin \ test-libelf.bin \ test-libelf-getphdrnum.bin \ @@ -58,19 +59,13 @@ FILES= \ test-lzma.bin \ test-bpf.bin \ test-libbpf.bin \ - test-libbpf-btf__load_from_kernel_by_id.bin \ - test-libbpf-bpf_prog_load.bin \ - test-libbpf-bpf_map_create.bin \ - test-libbpf-bpf_object__next_program.bin \ - test-libbpf-bpf_object__next_map.bin \ - test-libbpf-bpf_program__set_insns.bin \ - test-libbpf-btf__raw_data.bin \ test-get_cpuid.bin \ test-sdt.bin \ test-cxx.bin \ test-gettid.bin \ test-jvmti.bin \ test-jvmti-cmlr.bin \ + test-scandirat.bin \ test-sched_getcpu.bin \ test-setns.bin \ test-libopencsd.bin \ @@ -135,6 +130,9 @@ $(OUTPUT)test-get_current_dir_name.bin: $(OUTPUT)test-glibc.bin: $(BUILD) +$(OUTPUT)test-scandirat.bin: + $(BUILD) + $(OUTPUT)test-sched_getcpu.bin: $(BUILD) @@ -269,6 +267,9 @@ $(OUTPUT)test-libbfd-liberty-z.bin: $(OUTPUT)test-cplus-demangle.bin: $(BUILD) -liberty +$(OUTPUT)test-cxa-demangle.bin: + $(BUILDXX) + $(OUTPUT)test-backtrace.bin: $(BUILD) diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 957c02c7b163..6f4bf386a3b5 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -114,6 +114,10 @@ # include "test-pthread-barrier.c" #undef main +#define main main_test_scandirat +# include "test-scandirat.c" +#undef main + #define main main_test_sched_getcpu # include "test-sched_getcpu.c" #undef main @@ -206,6 +210,7 @@ int main(int argc, char *argv[]) main_test_get_cpuid(); main_test_bpf(); main_test_libcrypto(); + main_test_scandirat(); main_test_sched_getcpu(); main_test_sdt(); main_test_setns(); diff --git a/tools/build/feature/test-cxa-demangle.cpp b/tools/build/feature/test-cxa-demangle.cpp new file mode 100644 index 000000000000..a3e712f65c37 --- /dev/null +++ b/tools/build/feature/test-cxa-demangle.cpp @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +#include <stdio.h> +#include <stdlib.h> +#include <cxxabi.h> + +int main(void) +{ + size_t len = 256; + char *output = (char*)malloc(len); + int status; + + output = abi::__cxa_demangle("FieldName__9ClassNameFd", output, &len, &status); + + printf("demangled symbol: {%s}\n", output); + + return 0; +} diff --git a/tools/build/feature/test-libbpf-bpf_map_create.c b/tools/build/feature/test-libbpf-bpf_map_create.c deleted file mode 100644 index b9f550e332c8..000000000000 --- a/tools/build/feature/test-libbpf-bpf_map_create.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <bpf/bpf.h> - -int main(void) -{ - return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */, - 0 /* value_size */, 0 /* max_entries */, NULL /* opts */); -} diff --git a/tools/build/feature/test-libbpf-bpf_object__next_map.c b/tools/build/feature/test-libbpf-bpf_object__next_map.c deleted file mode 100644 index 64adb519e97e..000000000000 --- a/tools/build/feature/test-libbpf-bpf_object__next_map.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <bpf/libbpf.h> - -int main(void) -{ - bpf_object__next_map(NULL /* obj */, NULL /* prev */); - return 0; -} diff --git a/tools/build/feature/test-libbpf-bpf_object__next_program.c b/tools/build/feature/test-libbpf-bpf_object__next_program.c deleted file mode 100644 index 8bf4fd26b545..000000000000 --- a/tools/build/feature/test-libbpf-bpf_object__next_program.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <bpf/libbpf.h> - -int main(void) -{ - bpf_object__next_program(NULL /* obj */, NULL /* prev */); - return 0; -} diff --git a/tools/build/feature/test-libbpf-bpf_prog_load.c b/tools/build/feature/test-libbpf-bpf_prog_load.c deleted file mode 100644 index 47f516d63ebc..000000000000 --- a/tools/build/feature/test-libbpf-bpf_prog_load.c +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <bpf/bpf.h> - -int main(void) -{ - return bpf_prog_load(0 /* prog_type */, NULL /* prog_name */, - NULL /* license */, NULL /* insns */, - 0 /* insn_cnt */, NULL /* opts */); -} diff --git a/tools/build/feature/test-libbpf-bpf_program__set_insns.c b/tools/build/feature/test-libbpf-bpf_program__set_insns.c deleted file mode 100644 index f3b7f18c8f49..000000000000 --- a/tools/build/feature/test-libbpf-bpf_program__set_insns.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <bpf/libbpf.h> - -int main(void) -{ - bpf_program__set_insns(NULL /* prog */, NULL /* new_insns */, 0 /* new_insn_cnt */); - return 0; -} diff --git a/tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c b/tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c deleted file mode 100644 index a17647f7d5a4..000000000000 --- a/tools/build/feature/test-libbpf-btf__load_from_kernel_by_id.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <bpf/btf.h> - -int main(void) -{ - btf__load_from_kernel_by_id(20151128); - return 0; -} diff --git a/tools/build/feature/test-libbpf-btf__raw_data.c b/tools/build/feature/test-libbpf-btf__raw_data.c deleted file mode 100644 index 57da31dd7581..000000000000 --- a/tools/build/feature/test-libbpf-btf__raw_data.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include <bpf/btf.h> - -int main(void) -{ - btf__raw_data(NULL /* btf_ro */, NULL /* size */); - return 0; -} diff --git a/tools/build/feature/test-libbpf.c b/tools/build/feature/test-libbpf.c index a508756cf4cc..cd9989f52119 100644 --- a/tools/build/feature/test-libbpf.c +++ b/tools/build/feature/test-libbpf.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 #include <bpf/libbpf.h> +#if !defined(LIBBPF_MAJOR_VERSION) || (LIBBPF_MAJOR_VERSION < 1) +#error At least libbpf 1.0 is required for Linux tools. +#endif + int main(void) { return bpf_object__open("test") ? 0 : -1; diff --git a/tools/build/feature/test-scandirat.c b/tools/build/feature/test-scandirat.c new file mode 100644 index 000000000000..d7e19e1858a5 --- /dev/null +++ b/tools/build/feature/test-scandirat.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <dirent.h> + +int main(void) +{ + // expects non-NULL, arg3 is 'restrict' so "pointers" have to be different + return scandirat(/*dirfd=*/ 0, /*dirp=*/ (void *)1, /*namelist=*/ (void *)2, /*filter=*/ (void *)3, /*compar=*/ (void *)4); +} + +#undef _GNU_SOURCE |