On Wed, 2024-02-28 at 16:37 -0800, Martin KaFai Lau wrote: [...] > > Yes, it's all sane in the above example. But imagine a stand-alone > > struct_ops program with no SEC(".struct_ops") at all: > > > > > > SEC("struct_ops/test1") > > int BPF_PROG(test1) { ... } > > > > /* nothing else */ > > > > Currently this will fail, right? > > > > And with your proposal it will succeed without actually even > > attempting to load the BPF program. Or am I misunderstanding? > > Yep, currently it should fail. > > Agree that we need to distinguish this case and prog->attach_btf_id is not > enough. This probably can be tracked in collect_st_ops_relos at the open phase. collect_st_ops_relos() should work, I'll add a flag to track this.