On Wed, Apr 24, 2024 at 2:30 PM Jose E. Marchesi <jose.marchesi@xxxxxxxxxx> wrote: > > > Hi Yonghong. > > > On 4/24/24 1:41 AM, Jose E. Marchesi wrote: > >> This little patch modifies selftests/bpf/Makefile so it passes the > >> following extra options when invoking gcc-bpf: > >> > >> -gbtf > >> This makes GCC to emit BTF debug info in .BTF and .BTF.ext. > > > > Could we do if '-g' is specified, for bpf program, > > btf will be automatically generated? > > Hmm, in principle I wouldn't oppose for -g to mean -gbtf instead of > -gdwarf. DWARF can always be generated by using -gdwarf. > > Faust, Indu, WDYT? > > >> > >> -mco-re > >> This tells GCC to generate CO-RE relocations in .BTF.ext. > > > > Can we make this default? That is, remove -mco-re option. I > > can imagine for any serious bpf program, co-re is a must. > > CO-RE depends on BTF. So I understand the above as making -mco-re the > default if BTF is generated, i.e. if -gbtf (or -g with the modification > above) are specified. Isn't that what clang does? Am I interpreting > correctly? > > >> > >> -masm=pseudoc > >> This tells GCC to emit BPF assembler using the pseudo-c syntax. > > > > Can we make it the other way round such that -masm=pseudoc is > > the default? You can have an option e.g., -masm=non-pseudoc, > > for the other format? > > We could add a configure-time build option: > > --with-bpf-default-asm-syntax={pseudoc,normal} > > so that GCC can be built to use whatever selected syntax as default. > Distros and people can then decide what to do. distros just ship stuff. It's our job to pick good defaults. I agree with Yonghong that -g should imply -gbtf for bpf target and -mco-re doesn't need to be a flag at all. Compiler should do it when it sees those special attributes in C code. -masm=pseudoc is a good default as well, since that's what everyone in bpf community is used to.