On 4/22/21 11:54 PM, Jose E. Marchesi via Gcc-patches wrote:
>
> Hi YiFei.
>
>> 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".
>
> Thanks for the patch.
> This is OK for both master and GCC 10.
>
OK for backport to GCC 11 (both patches)?