From: David Faust Date: Tue, 30 May 2023 16:16:36 +0000 (-0700) Subject: btf: be clear when record size/type is not used X-Git-Tag: basepoints/gcc-15~8694 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=008878653989da899c9756df0896a722d25e5498;p=thirdparty%2Fgcc.git btf: be clear when record size/type is not used All BTF type records have a 4-byte field used to encode a size or link to another type, depending on the type kind. But BTF_KIND_ARRAY and BTF_KIND_FWD do not use this field at all, and should write zero. GCC already correctly writes zero in this field for these type kinds, but the process is not straightforward and results in the -dA comment claiming the field is a reference to another type. This patch makes the behavior explicit and updates the assembler comment to state clearly that the field is unused. gcc/ * btfout.cc (btf_asm_type): Add dedicated cases for BTF_KIND_ARRAY and BTF_KIND_FWD which do not use the size/type field at all. --- diff --git a/gcc/btfout.cc b/gcc/btfout.cc index 497c1ca06e6e..ae9855716ebf 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -705,6 +705,12 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd) dw2_asm_output_data (4, dtd->dtd_data.ctti_size, "btt_size: %uB", dtd->dtd_data.ctti_size); return; + case BTF_KIND_ARRAY: + case BTF_KIND_FWD: + /* These types do not encode any information in the size/type field + and should write 0. */ + dw2_asm_output_data (4, 0, "(unused)"); + return; default: break; }