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

yonghong-song via All-commits all-commits at lists.llvm.org
Thu Jun 10 16:16:21 PDT 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b149c437194d10877e9e45b3d8cc9252af1944b
      https://github.com/llvm/llvm-project/commit/5b149c437194d10877e9e45b3d8cc9252af1944b
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-06-10 (Thu, 10 Jun 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

(cherry picked from commit 968292cb93198442138128d850fd54dc7edc0035)




More information about the All-commits mailing list