History

libbpf: add support for bpf_call

- recognize relocation emitted by llvm - since all regular function will be kept in .text section and llvm takes care of pc-relative offsets in bpf_call instruction simply copy all of .text to relevant program section while adjusting bpf_call instructions in program section to point to newly copied body of instructions from .text - do so for all programs in the elf file - set all programs types to the one passed to bpf_prog_load() Note for elf files with multiple programs that use different functions in .text section we need to do 'linker' style logic. This work is still TBD

Alexei Starovoitov committed 8 years ago

Commit 48cca7e1 parent d98588c3 files · +134 −44Browse files

Showing the changes to tools/include/uapi/linux (1 of 3 files). Show all

Unified · Split

tools/include/uapi/linux/bpf.h+6−0
@@ -197,8 +197,14 @@ enum bpf_attach_type { · 196 unmodified lines
197197 */
198198 #define BPF_F_STRICT_ALIGNMENT (1U << 0)
199199
200+/* when bpf_ldimm64->src_reg == BPF_PSEUDO_MAP_FD, bpf_ldimm64->imm == fd */
200201 #define BPF_PSEUDO_MAP_FD 1
201202
203+/* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
204+ * offset to another bpf function
205+ */
206+#define BPF_PSEUDO_CALL 1
207+
202208 /* flags for BPF_MAP_UPDATE_ELEM command */
203209 #define BPF_ANY 0 /* create new element or update existing */
204210 #define BPF_NOEXIST 1 /* create new element if it didn't exist */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t