[PATCH] D100392: BPF: remove default .extern data section

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 09:30:56 PDT 2021


yonghong-song created this revision.
yonghong-song added reviewers: ast, anakryiko.
Herald added a subscriber: hiraditya.
yonghong-song requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, for any extern variable, if it doesn't have
section attribution, it will be put into a default ".extern"
btf DataSec. The initial design is to put every extern
variable in a DataSec so libbpf can use it.

But later on, libbpf actually requires extern variables
to put into special sections, e.g., ".kconfig", ".ksyms", etc.
so they can be used properly based on section name.

Andrii mentioned since ".extern" variables are 
not actually used, it makes sense to remove it from
the compiler so libbpf does not need to deal with it, 
esp. for static linking. The BTF for these extern variables
is still generated.

With this patch, I tested kernel selftests/bpf and all tests
passed. Indeed, removing ".extern" DataSec seems having no
impact.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100392

Files:
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/test/CodeGen/BPF/BTF/extern-var-struct-weak.ll
  llvm/test/CodeGen/BPF/BTF/extern-var-struct.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100392.337187.patch
Type: text/x-patch
Size: 4998 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210413/522f662f/attachment.bin>


More information about the llvm-commits mailing list