https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112656
--- Comment #7 from Indu Bhagat <ibhagat at gcc dot gnu.org> --- Currently generating everything at finish () when -mco-re is in effect is sufficient for BPF needs. BTF is generated late for -mco-re because of CO-RE relocations: these are strings which record indexes into the source-level data structures, e.g. "0:4:2:3", and are stored int the .BTF string table. CO-RE is handled in the BPF backend during expand, which is after debug_early_finish (). 'Whether we should split BTF generation into two parts' is a larger question not affecting the current PR at hand, I think. We should evaluate the overall benefit of that approach (apart from the one we are seeing here - reproducible BTF across targets), vs the implementation cost and complexity. If there is interest.