mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-21 08:49:06 +08:00
selftests/bpf: Workaround for llvm nop-4 bug
Currently LLVM fails to recognize .data.* as data section and defaults to .text section. Later BPF backend tries to emit 4-byte NOP instruction which doesn't exist in BPF ISA and aborts. The fix for LLVM is pending: https://reviews.llvm.org/D138477 While waiting for the fix lets workaround the linked_list test case by using .bss.* prefix which is properly recognized by LLVM as BSS section. Fix libbpf to support .bss. prefix and adjust tests. Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Andrii Nakryiko
parent
95959419a7
commit
ca515c0dda
@@ -3511,7 +3511,8 @@ static int bpf_object__elf_collect(struct bpf_object *obj)
|
||||
sec_desc->sec_type = SEC_RELO;
|
||||
sec_desc->shdr = sh;
|
||||
sec_desc->data = data;
|
||||
} else if (sh->sh_type == SHT_NOBITS && strcmp(name, BSS_SEC) == 0) {
|
||||
} else if (sh->sh_type == SHT_NOBITS && (strcmp(name, BSS_SEC) == 0 ||
|
||||
str_has_pfx(name, BSS_SEC "."))) {
|
||||
sec_desc->sec_type = SEC_BSS;
|
||||
sec_desc->shdr = sh;
|
||||
sec_desc->data = data;
|
||||
|
||||
Reference in New Issue
Block a user