Commit d8dfe5bf authored by Yonghong Song's avatar Yonghong Song Committed by Alexei Starovoitov

tools/bpf: Sync btf_ids.h to tools

Sync kernel header btf_ids.h to tools directory.
Also define macro CONFIG_DEBUG_INFO_BTF before
including btf_ids.h in prog_tests/resolve_btfids.c
since non-stub definitions for BTF_ID_LIST etc. macros
are defined under CONFIG_DEBUG_INFO_BTF. This
prevented test_progs from failing.
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200720163359.1393079-1-yhs@fb.com
parent bc4f0548
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#ifndef _LINUX_BTF_IDS_H #ifndef _LINUX_BTF_IDS_H
#define _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H
#ifdef CONFIG_DEBUG_INFO_BTF
#include <linux/compiler.h> /* for __PASTE */ #include <linux/compiler.h> /* for __PASTE */
/* /*
...@@ -21,7 +23,7 @@ ...@@ -21,7 +23,7 @@
asm( \ asm( \
".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \
".local " #symbol " ; \n" \ ".local " #symbol " ; \n" \
".type " #symbol ", @object; \n" \ ".type " #symbol ", STT_OBJECT; \n" \
".size " #symbol ", 4; \n" \ ".size " #symbol ", 4; \n" \
#symbol ": \n" \ #symbol ": \n" \
".zero 4 \n" \ ".zero 4 \n" \
...@@ -83,5 +85,12 @@ asm( \ ...@@ -83,5 +85,12 @@ asm( \
".zero 4 \n" \ ".zero 4 \n" \
".popsection; \n"); ".popsection; \n");
#else
#define BTF_ID_LIST(name) static u32 name[5];
#define BTF_ID(prefix, name)
#define BTF_ID_UNUSED
#endif /* CONFIG_DEBUG_INFO_BTF */
#endif #endif
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <bpf/libbpf.h> #include <bpf/libbpf.h>
#include <linux/btf.h> #include <linux/btf.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#define CONFIG_DEBUG_INFO_BTF
#include <linux/btf_ids.h> #include <linux/btf_ids.h>
#include "test_progs.h" #include "test_progs.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment