diff options
Diffstat (limited to 'tools/build/feature')
-rw-r--r-- | tools/build/feature/.gitignore | 1 | ||||
-rw-r--r-- | tools/build/feature/Makefile | 12 | ||||
-rw-r--r-- | tools/build/feature/test-clang-bpf-global-var.c | 4 | ||||
-rw-r--r-- | tools/build/feature/test-file-handle.c | 17 |
4 files changed, 33 insertions, 1 deletions
diff --git a/tools/build/feature/.gitignore b/tools/build/feature/.gitignore index 09b335b98842..15fcd34acdb9 100644 --- a/tools/build/feature/.gitignore +++ b/tools/build/feature/.gitignore @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only *.d *.bin *.output diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 7ac0d8088565..92012381393a 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -67,7 +67,9 @@ FILES= \ test-llvm.bin \ test-llvm-version.bin \ test-libaio.bin \ - test-libzstd.bin + test-libzstd.bin \ + test-clang-bpf-global-var.bin \ + test-file-handle.bin FILES := $(addprefix $(OUTPUT),$(FILES)) @@ -75,6 +77,7 @@ CC ?= $(CROSS_COMPILE)gcc CXX ?= $(CROSS_COMPILE)g++ PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config LLVM_CONFIG ?= llvm-config +CLANG ?= clang all: $(FILES) @@ -321,6 +324,13 @@ $(OUTPUT)test-libaio.bin: $(OUTPUT)test-libzstd.bin: $(BUILD) -lzstd +$(OUTPUT)test-clang-bpf-global-var.bin: + $(CLANG) -S -g -target bpf -o - $(patsubst %.bin,%.c,$(@F)) | \ + grep BTF_KIND_VAR + +$(OUTPUT)test-file-handle.bin: + $(BUILD) + ############################### clean: diff --git a/tools/build/feature/test-clang-bpf-global-var.c b/tools/build/feature/test-clang-bpf-global-var.c new file mode 100644 index 000000000000..221f1481d52e --- /dev/null +++ b/tools/build/feature/test-clang-bpf-global-var.c @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2020 Facebook + +volatile int global_value_for_test = 1; diff --git a/tools/build/feature/test-file-handle.c b/tools/build/feature/test-file-handle.c new file mode 100644 index 000000000000..4d3b03b27a0b --- /dev/null +++ b/tools/build/feature/test-file-handle.c @@ -0,0 +1,17 @@ +#define _GNU_SOURCE +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <inttypes.h> + +int main(void) +{ + struct { + struct file_handle fh; + uint64_t cgroup_id; + } handle; + int mount_id; + + name_to_handle_at(AT_FDCWD, "/", &handle.fh, &mount_id, 0); + return 0; +} |