[PATCH 1/2] bpf: align function entry point to 64 bits

2021-04-22 Thread YiFei Zhu via Gcc-patches
Libbpf does not treat paddings after functions well. If function symbols does not cover a whole text section, it will emit error similar to: libbpf: sec '.text': failed to find program symbol at offset 56 Each instruction in BPF is a multiple of 8 bytes, so align the functions to 8 bytes, simil

[PATCH 2/2] bpf: allow BSS symbols to be global symbols

2021-04-22 Thread YiFei Zhu via Gcc-patches
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: b foo 0004 b bar Both symbols are local. However, libbpf bpf_object__variable_offs

Re: [PATCH 2/2] bpf: allow BSS symbols to be global symbols

2021-04-23 Thread YiFei Zhu via Gcc-patches
On Fri, Apr 23, 2021 at 12:25 PM David Faust wrote: > I've just checked in both patches to master and GCC 10 on your behalf. On 4/22/21 11:54 PM, Jose E. Marchesi via Gcc-patches wrote: > Thanks for the patch. > This is OK for both master and GCC 10. Thanks to both of you :) YiFei Zhu