[all-commits] [llvm/llvm-project] a285bd: BPF: remove default .extern data section

yonghong-song via All-commits all-commits at lists.llvm.org
Tue Apr 13 11:38:12 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a285bdb56fb47a05281afdcb84d96c1fa3da63c1
      https://github.com/llvm/llvm-project/commit/a285bdb56fb47a05281afdcb84d96c1fa3da63c1
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-04-13 (Tue, 13 Apr 2021)

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

  Log Message:
  -----------
  BPF: remove default .extern data section

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.

Differential Revision: https://reviews.llvm.org/D100392




More information about the All-commits mailing list