llvm-project/llvm/test/CodeGen/BPF/BTF
Yonghong Song dc1c43d726 [BPF] Add BTF 64bit enum value support
Current BTF only supports 32-bit value. For example,
  enum T { VAL = 0xffffFFFF00000008 };
the generated BTF looks like
        .long   16                              # BTF_KIND_ENUM(id = 4)
        .long   100663297                       # 0x6000001
        .long   8
        .long   18
        .long   8
The encoded value is 8 which equals to (uint32_t)0xffffFFFF00000008
and this is incorrect.

This patch introduced BTF_KIND_ENUM64 which permits to encode
64-bit value. The format for each enumerator looks like:
        .long   name_offset
        .long   (uint32_t)value # lower-32 bit value
        .long   value >> 32     # high-32 bit value

We use two 32-bit values to represent a 64-bit value as current
BTF type subsection has 4-byte alignment and gaps are not permitted
in the subsection.

This patch also added support for kflag (the bit 31 of CommonType.Info)
such that kflag = 1 implies the value is signed and kflag = 0
implies the value is unsigned. The kernel UAPI enumerator definition is
  struct btf_enum {
        __u32   name_off;
        __s32   val;
  };
so kflag = 0 with unsigned value provides backward compatability.

With this patch, for
  enum T { VAL = 0xffffFFFF00000008 };
the generated BTF looks like
        .long   16                              # BTF_KIND_ENUM64(id = 4)
        .long   3187671053                      # 0x13000001
        .long   8
        .long   18
        .long   8                               # 0x8
        .long   4294967295                      # 0xffffffff
and the enumerator value and signedness are encoded correctly.

Differential Revision: https://reviews.llvm.org/D124641
2022-06-06 11:35:50 -07:00
..
align.ll BPF: set .BTF and .BTF.ext section alignment to 4 2021-10-19 16:26:01 -07:00
array-1d-char.ll
array-1d-int.ll
array-2d-int.ll
array-size-0.ll
array-typedef.ll
binary-format.ll
builtin-btf-type-id-2.ll
builtin-btf-type-id.ll
char-no-debuginfo.ll
char.ll
double.ll
empty-btf.ll
enum-basic.ll [BPF] Add BTF 64bit enum value support 2022-06-06 11:35:50 -07:00
extern-builtin.ll
extern-func-arg.ll
extern-func-ptr.ll
extern-global-var.ll
extern-var-func-weak-section.ll
extern-var-func-weak.ll
extern-var-func.ll
extern-var-section.ll
extern-var-struct-weak.ll
extern-var-struct.ll
extern-var-weak-section.ll
filename.ll
float.ll
func-func-ptr.ll
func-non-void.ll [BPF] Fix tests that fail if /tmp/t.c exists 2022-02-25 14:55:53 -08:00
func-source.ll
func-typedef.ll
func-unused-arg.ll [BPF] Fix tests that fail if /tmp/t.c exists 2022-02-25 14:55:53 -08:00
func-void.ll [BPF] Fix tests that fail if /tmp/t.c exists 2022-02-25 14:55:53 -08:00
fwd-no-define.ll
fwd-with-define.ll
global-var-inited.ll
global-var-sec-readonly.ll
global-var-sec.ll
int.ll
local-var-readonly-1.ll
local-var-readonly-2.ll
local-var.ll
longlong.ll
map-def-2.ll
map-def-3.ll
map-def.ll
pruning-const.ll
pruning-multi-derived-type.ll [BPF] Fix a BTF type pruning bug 2022-02-16 17:23:34 -08:00
pruning-typedef.ll
ptr-const-void.ll
ptr-func-1.ll
ptr-func-2.ll
ptr-func-3.ll
ptr-int.ll
ptr-prune-type.ll
ptr-void.ll
ptr-volatile-const-void.ll
ptr-volatile-void.ll
restrict-ptr.ll
short.ll
static-func.ll
static-var-derived-type.ll
static-var-inited-sec.ll
static-var-inited.ll
static-var-readonly-sec.ll
static-var-readonly.ll
static-var-sec.ll
static-var-zerolen-array.ll
static-var.ll
struct-anon-2.ll
struct-anon.ll
struct-basic.ll
struct-bitfield-typedef.ll
struct-enum.ll
tag-1.ll BPF: rename BTF_KIND_TAG to BTF_KIND_DECL_TAG 2021-10-11 21:33:39 -07:00
tag-2.ll BPF: rename BTF_KIND_TAG to BTF_KIND_DECL_TAG 2021-10-11 21:33:39 -07:00
tag-typedef.ll BPF: emit BTF_KIND_DECL_TAG for typedef types 2021-10-21 12:09:42 -07:00
type-tag-fixup-fwd.ll [BPF] Fix a bug in BTF_KIND_TYPE_TAG generation 2022-02-14 19:43:57 -08:00
type-tag-fixup-resolved.ll [BPF] Fix a bug in BTF_KIND_TYPE_TAG generation 2022-02-14 19:43:57 -08:00
type-tag-var.ll BPF: change btf_type_tag BTF output format 2021-11-09 11:34:25 -08:00
uchar.ll
uint.ll
ulonglong.ll
union-array-typedef.ll
ushort.ll
weak-global-2.ll
weak-global-3.ll
weak-global.ll