]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bpf: Prevent .BTF section elimination
authorTony Ambardar <tony.ambardar@gmail.com>
Sun, 20 Sep 2020 05:01:34 +0000 (22:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Oct 2020 08:32:58 +0000 (10:32 +0200)
commit 65c204398928f9c79f1a29912b410439f7052635 upstream.

Systems with memory or disk constraints often reduce the kernel footprint
by configuring LD_DEAD_CODE_DATA_ELIMINATION. However, this can result in
removal of any BTF information.

Use the KEEP() macro to preserve the BTF data as done with other important
sections, while still allowing for smaller kernels.

Fixes: 90ceddcb4950 ("bpf: Support llvm-objcopy for vmlinux BTF")
Signed-off-by: Tony Ambardar <Tony.Ambardar@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/a635b5d3e2da044e7b51ec1315e8910fbce0083f.1600417359.git.Tony.Ambardar@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/asm-generic/vmlinux.lds.h

index f050039ca2c07a87f1f20f0430c36896fd60d8ae..e5e2425875953b6fd0a6664b92480b5fd12d1d2f 100644 (file)
 #define BTF                                                            \
        .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) {                           \
                __start_BTF = .;                                        \
-               *(.BTF)                                                 \
+               KEEP(*(.BTF))                                           \
                __stop_BTF = .;                                         \
        }
 #else