This is an archive of the discontinued LLVM Phabricator instance.

[BPF] emit BTF sections only if debuginfo available
ClosedPublic

Authored by yonghong-song on May 11 2019, 11:16 AM.

Details

Summary

Currently, without -g, BTF sections may still be emitted with
data sections, e.g., for linux kernel bpf selftest
test_tcp_check_syncookie_kern.c issue discovered by Martin
as shown below.

-bash-4.4$ bpftool btf dump file test_tcp_check_syncookie_kern.o
[1] VAR 'results' type_id=0, linkage=global-alloc
[2] VAR '_license' type_id=0, linkage=global-alloc
[3] DATASEC 'license' size=0 vlen=1

type_id=2 offset=0 size=4

[4] DATASEC 'maps' size=0 vlen=1

type_id=1 offset=0 size=28

Let disable BTF generation if no debuginfo, which is
the original design.

Diff Detail

Repository
rL LLVM

Event Timeline

yonghong-song created this revision.May 11 2019, 11:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2019, 11:16 AM
ast accepted this revision.May 12 2019, 6:59 PM
This revision is now accepted and ready to land.May 12 2019, 6:59 PM
This revision was automatically updated to reflect the committed changes.