diff --git a/testdata/btf_map_init-eb.elf b/testdata/btf_map_init-eb.elf index 72f2b9132..f2987d85c 100644 Binary files a/testdata/btf_map_init-eb.elf and b/testdata/btf_map_init-eb.elf differ diff --git a/testdata/btf_map_init-el.elf b/testdata/btf_map_init-el.elf index 6e2a137c6..eb64be4d2 100644 Binary files a/testdata/btf_map_init-el.elf and b/testdata/btf_map_init-el.elf differ diff --git a/testdata/btf_map_init.c b/testdata/btf_map_init.c index 7f6ae96e0..1640a82c5 100644 --- a/testdata/btf_map_init.c +++ b/testdata/btf_map_init.c @@ -2,8 +2,6 @@ #include "common.h" -#if __clang_major__ >= 9 - int __section("socket/tail") tail_1() { return 42; } @@ -54,7 +52,3 @@ struct { [1] = &inner_map, }, }; - -#else -#error This file has to be compiled with clang >= 9 -#endif diff --git a/testdata/invalid_btf_map_init.c b/testdata/invalid_btf_map_init.c index 8938d2ebe..6deb172ae 100644 --- a/testdata/invalid_btf_map_init.c +++ b/testdata/invalid_btf_map_init.c @@ -2,7 +2,6 @@ #include "common.h" -#if __clang_major__ >= 9 struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, uint32_t); @@ -12,6 +11,3 @@ struct { /* This forces a non-zero byte into the .maps section. */ .key = (void *)1, }; -#else -#error This file has to be compiled with clang >= 9 -#endif diff --git a/testdata/loader-clang-11-eb.elf b/testdata/loader-clang-11-eb.elf index 8961f8a37..d9ef2e3a0 100644 Binary files a/testdata/loader-clang-11-eb.elf and b/testdata/loader-clang-11-eb.elf differ diff --git a/testdata/loader-clang-11-el.elf b/testdata/loader-clang-11-el.elf index 1c3479f7e..54fc20d4b 100644 Binary files a/testdata/loader-clang-11-el.elf and b/testdata/loader-clang-11-el.elf differ diff --git a/testdata/loader-clang-14-eb.elf b/testdata/loader-clang-14-eb.elf index 9b05b0519..1fbe7a50d 100644 Binary files a/testdata/loader-clang-14-eb.elf and b/testdata/loader-clang-14-eb.elf differ diff --git a/testdata/loader-clang-14-el.elf b/testdata/loader-clang-14-el.elf index 0e8fc9d06..1a2aeb6d5 100644 Binary files a/testdata/loader-clang-14-el.elf and b/testdata/loader-clang-14-el.elf differ diff --git a/testdata/loader-clang-17-eb.elf b/testdata/loader-clang-17-eb.elf index 9b05b0519..1fbe7a50d 100644 Binary files a/testdata/loader-clang-17-eb.elf and b/testdata/loader-clang-17-eb.elf differ diff --git a/testdata/loader-clang-17-el.elf b/testdata/loader-clang-17-el.elf index 0e8fc9d06..1a2aeb6d5 100644 Binary files a/testdata/loader-clang-17-el.elf and b/testdata/loader-clang-17-el.elf differ diff --git a/testdata/loader.c b/testdata/loader.c index 13915989e..8875be82e 100644 --- a/testdata/loader.c +++ b/testdata/loader.c @@ -5,8 +5,6 @@ char __license[] __section("license") = "MIT"; -#if __clang_major__ >= 9 -// Clang < 9 doesn't emit the necessary BTF for this to work. struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, uint32_t); @@ -64,27 +62,6 @@ struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); __uint(max_entries, 4096); } perf_event_array __section(".maps"); -#else -struct bpf_map_def hash_map __section("maps") = { - .type = BPF_MAP_TYPE_HASH, - .key_size = sizeof(uint32_t), - .value_size = sizeof(uint64_t), - .max_entries = 1, - .map_flags = BPF_F_NO_PREALLOC, -}; - -struct bpf_map_def hash_map2 __section("maps") = { - .type = BPF_MAP_TYPE_HASH, - .key_size = sizeof(uint32_t), - .value_size = sizeof(uint64_t), - .max_entries = 2, -}; - -struct bpf_map_def perf_event_array __section("maps") = { - .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, - .max_entries = 4096, -}; -#endif struct bpf_map_def array_of_hash_map __section("maps") = { .type = BPF_MAP_TYPE_ARRAY_OF_MAPS, @@ -108,23 +85,14 @@ int __attribute__((noinline)) global_fn(uint32_t arg) { return static_fn(arg) + global_fn2(arg) + global_fn3(arg); } -#if __clang_major__ >= 9 static volatile unsigned int key1 = 0; // .bss static volatile unsigned int key2 = 1; // .data volatile const unsigned int key3 = 2; // .rodata static volatile const uint32_t arg; // .rodata, populated by loader // custom .rodata section, populated by loader static volatile const uint32_t arg2 __section(".rodata.test"); -#endif __section("xdp") int xdp_prog() { -#if __clang_major__ < 9 - unsigned int key1 = 0; - unsigned int key2 = 1; - unsigned int key3 = 2; - uint32_t arg = 1; - uint32_t arg2 = 2; -#endif map_lookup_elem(&hash_map, (void *)&key1); map_lookup_elem(&hash_map2, (void *)&key2); map_lookup_elem(&hash_map2, (void *)&key3); @@ -143,7 +111,6 @@ __section("socket/2") int asm_relocation() { return my_const; } -#if __clang_major__ >= 9 volatile const unsigned int uneg = -1; volatile const int neg = -2; static volatile const unsigned int static_uneg = -3; @@ -164,11 +131,6 @@ __section("socket/3") int data_sections() { return 0; } -#else -__section("socket/3") int data_sections() { - return 0; -} -#endif /* * Up until LLVM 14, this program results in an .rodata.cst32 section diff --git a/testdata/map_spin_lock.c b/testdata/map_spin_lock.c index bd092798b..2348bb700 100644 --- a/testdata/map_spin_lock.c +++ b/testdata/map_spin_lock.c @@ -11,13 +11,9 @@ struct hash_elem { struct bpf_spin_lock lock; }; -#if __clang_major__ >= 9 struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, uint32_t); __type(value, struct hash_elem); __uint(max_entries, 2); } spin_lock_map __section(".maps"); -#else -#error This file required clang >= 9 -#endif