From 785af69d8054c2d39b13ae3bcdf7426df2d3f0c7 Mon Sep 17 00:00:00 2001 From: gameloader Date: Tue, 8 Mar 2022 15:00:03 +0800 Subject: [PATCH] change post file --- content/posts/libbpf_minimal.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/posts/libbpf_minimal.md b/content/posts/libbpf_minimal.md index 28586db..f57f35f 100644 --- a/content/posts/libbpf_minimal.md +++ b/content/posts/libbpf_minimal.md @@ -46,3 +46,8 @@ Minimal程序使用了SEC宏,展开后结果分析如下: #### __attribute\_\_ {#attribute} __attribute__也是一种编译器指令,用于在声明(函数,变量,类型)时帮助声明对象向编译器告知某些编译特性。在gnu网站上可以查知 **[可用的属性](https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html)** ,在此处的含义为,将对应的函数放入指定的name段中,并且即使该函数没有被引用也不允许将该自定义的段优化掉(used)。 + +#### SEC整体功能 {#SEC整体功能} + +博客中给出的解释为 +> libbpf is able to automatically determine where to attach BPF program to by looking at its special SEC() annotation. This doesn't work for all possible BPF program types, but it does for lots of them: tracepoints, kprobes, and quite a few others. Additionally, libbpf provides extra APIs to do the attachment programmatically.