HomePhabricator

BPF: generate proper BTF for globals with WeakODRLinkage

Authored by yonghong-song on Apr 12 2021, 10:45 PM.

Description

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

Details

Committed
yonghong-songApr 13 2021, 8:54 AM
Differential Revision
D100362: BPF: generate proper BTF for globals with WeakODRLinkage
Parents
rGb5b2c81055cf: [clangd] Propagate data in diagnostics
Branches
Unknown
Tags
Unknown