diff options
author | YiFei Zhu <zhuyifei1999@gmail.com> | 2021-04-22 05:05:57 -0500 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2021-04-23 09:56:21 -0700 |
commit | 886b6c1e8af502b69e3f318b9830b73b88215878 (patch) | |
tree | f0c571bf02002a92edeb420d9c6d8b0724c80f95 /gcc/tree-complex.c | |
parent | 0a662e103e911af935aa5c601051c135986ce3de (diff) | |
download | gcc-886b6c1e8af502b69e3f318b9830b73b88215878.zip gcc-886b6c1e8af502b69e3f318b9830b73b88215878.tar.gz gcc-886b6c1e8af502b69e3f318b9830b73b88215878.tar.bz2 |
bpf: allow BSS symbols to be global symbols
Prior to this, a BSS declaration such as:
int foo;
static int bar;
Generates:
.global foo
.local foo
.comm foo,4,4
.local bar
.comm bar,4,4
Creating symbols:
0000000000000000 b foo
0000000000000004 b bar
Both symbols are local. However, libbpf bpf_object__variable_offset
rquires symbols to be STB_GLOBAL & STT_OBJECT for data section lookup.
This patch makes the same declaration generate:
.global foo
.type foo, @object
.lcomm foo,4,4
.local bar
.comm bar,4,4
Creating symbols:
0000000000000000 B foo
0000000000000004 b bar
And libbpf will be okay with looking up the global symbol "foo".
2021-04-22 YiFei Zhu <zhuyifei1999@gmail.com>
gcc/
* config/bpf/bpf.h (ASM_OUTPUT_ALIGNED_BSS): Use .type and .lcomm.
Diffstat (limited to 'gcc/tree-complex.c')
0 files changed, 0 insertions, 0 deletions