]> git.ipfire.org Git - thirdparty/gcc.git/commit
btf: do not use the CHAR `encoding' bit for BTF
authorJose E. Marchesi <jose.marchesi@oracle.com>
Fri, 22 Jul 2022 10:40:50 +0000 (12:40 +0200)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Tue, 2 Aug 2022 17:25:21 +0000 (19:25 +0200)
commit5df04a7aa837a13b0e14d269c37bd3871d86bf08
treebff5a3fb0832cd3443b0db1d1515a3c77b489e20
parent6a11f2d974a912aaaedb0ce32cdfde10193003cd
btf: do not use the CHAR `encoding' bit for BTF

Contrary to CTF and our previous expectations, as per [1], turns out
that in BTF:

1) The `encoding' field in integer types shall not be treated as a
   bitmap, but as an enumerated, i.e. these bits are exclusive to each
   other.

2) The CHAR bit in `encoding' shall _not_ be set when emitting types
   for char nor `unsigned char'.

Consequently this patch clears the CHAR bit before emitting the
variable part of BTF integral types.  It also updates the testsuite
accordingly, expanding it to check for BOOL bits.

[1] https://lore.kernel.org/bpf/a73586ad-f2dc-0401-1eba-2004357b7edf@fb.com/T/#t

gcc/ChangeLog:

* btfout.cc (output_asm_btf_vlen_bytes): Do not use the CHAR
encoding bit in BTF.

gcc/testsuite/ChangeLog:

* gcc.dg/debug/btf/btf-int-1.c: Do not check for char bits in
bti_encoding and check for bool bits.
gcc/btfout.cc
gcc/testsuite/gcc.dg/debug/btf/btf-int-1.c