[all-commits] [llvm/llvm-project] 968292: BPF: generate proper BTF for globals with WeakODRL...

yonghong-song via All-commits all-commits at lists.llvm.org
Tue Apr 13 08:54:56 PDT 2021


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

  Changed paths:
    M llvm/lib/Target/BPF/BTFDebug.cpp
    A llvm/test/CodeGen/BPF/BTF/weak-global-3.ll

  Log Message:
  -----------
  BPF: generate proper BTF for globals with WeakODRLinkage

For a global weak symbol defined as below:
  char g __attribute__((weak)) = 2;
LLVM generates an allocated global with WeakAnyLinkage,
for which BPF backend generates proper BTF info.

For the above example, if a modifier "const" is added like
  const char g __attribute__((weak)) = 2;
LLVM generates an allocated global with WeakODRLinkage,
for which BPF backend didn't generate any BTF as it
didn't handle WeakODRLinkage.

This patch addes support for WeakODRLinkage and proper
BTF info can be generated for weak symbol defined with
"const" modifier.

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




More information about the All-commits mailing list