[PATCH] D100362: BPF: generate proper BTF for globals with WeakODRLinkage

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 22:59:50 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.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100362

Files:
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/test/CodeGen/BPF/BTF/weak-global-3.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100362.337048.patch
Type: text/x-patch
Size: 5401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210413/4a737856/attachment.bin>


More information about the llvm-commits mailing list