chiyuze added a comment. Regarding cost, only BPF target triggers this debug info generation for extern variables. There is no impact on x86 builds of clang:
Without patch: bloaty build/RelWithDebInfo/83d47ba15a1229a21aaca8a8d6a33e0e90aabfd4/bin/clang FILE SIZE VM SIZE -------------- -------------- 74.7% 2.98Gi 0.0% 0 .debug_info 9.2% 377Mi 0.0% 0 .debug_loclists 5.2% 210Mi 0.0% 0 .debug_str 4.3% 177Mi 0.0% 0 .debug_line 2.0% 81.5Mi 53.7% 81.5Mi .text 1.7% 68.0Mi 0.0% 0 .debug_rnglists 1.1% 43.2Mi 28.5% 43.2Mi .rodata 0.5% 21.4Mi 0.0% 0 .debug_abbrev 0.5% 20.3Mi 0.0% 0 .strtab 0.2% 8.79Mi 5.8% 8.79Mi .eh_frame 0.2% 6.73Mi 4.4% 6.73Mi .rela.dyn 0.1% 4.86Mi 0.0% 0 .symtab 0.1% 4.09Mi 2.7% 4.09Mi .dynstr 0.1% 3.60Mi 2.4% 3.60Mi .data.rel.ro 0.1% 3.30Mi 0.0% 0 .debug_aranges 0.0% 1.19Mi 0.8% 1.19Mi .dynsym 0.0% 1.09Mi 0.7% 1.09Mi .eh_frame_hdr 0.0% 0 0.4% 611Ki .bss 0.0% 449Ki 0.1% 127Ki [25 Others] 0.0% 393Ki 0.3% 393Ki .gnu.hash 0.0% 332Ki 0.2% 332Ki .data 100.0% 3.99Gi 100.0% 151Mi TOTAL With patch: bloaty build/RelWithDebInfo/23bc4427ab49716ce2c24c81529d9c90953b3c54/bin/clang FILE SIZE VM SIZE -------------- -------------- 74.7% 2.98Gi 0.0% 0 .debug_info 9.2% 377Mi 0.0% 0 .debug_loclists 5.2% 210Mi 0.0% 0 .debug_str 4.3% 177Mi 0.0% 0 .debug_line 2.0% 81.5Mi 53.7% 81.5Mi .text 1.7% 68.0Mi 0.0% 0 .debug_rnglists 1.1% 43.2Mi 28.5% 43.2Mi .rodata 0.5% 21.4Mi 0.0% 0 .debug_abbrev 0.5% 20.3Mi 0.0% 0 .strtab 0.2% 8.79Mi 5.8% 8.79Mi .eh_frame 0.2% 6.73Mi 4.4% 6.73Mi .rela.dyn 0.1% 4.86Mi 0.0% 0 .symtab 0.1% 4.09Mi 2.7% 4.09Mi .dynstr 0.1% 3.60Mi 2.4% 3.60Mi .data.rel.ro 0.1% 3.30Mi 0.0% 0 .debug_aranges 0.0% 1.19Mi 0.8% 1.19Mi .dynsym 0.0% 1.09Mi 0.7% 1.09Mi .eh_frame_hdr 0.0% 0 0.4% 611Ki .bss 0.0% 449Ki 0.1% 127Ki [25 Others] 0.0% 393Ki 0.3% 393Ki .gnu.hash 0.0% 332Ki 0.2% 332Ki .data 100.0% 3.99Gi 100.0% 151Mi TOTAL For BPF, this debug info is needed to generate proper BTF and use kconfig <https://nakryiko.com/posts/bpf-core-reference-guide/#kconfig-extern-variables>. This patch just enables it for C++, which makes it possible for us to leverage templates to deduplicate almost identical BPF code for IPv4 and IPv6. https://reviews.llvm.org/D70696 has more details regarding why it is needed for BPF in general and https://lore.kernel.org/bpf/cakh8qbt4xqbupxefqpk5ayu1rr0-h-vcjzs_0bu-987gl4w...@mail.gmail.com/ has more details regarding why we are trying to compile BPF from C++. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153898/new/ https://reviews.llvm.org/D153898 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits