Em Thu, Jan 10, 2019 at 12:20:36PM -0300, Arnaldo Carvalho de Melo escreveu: > This case, for instance: > struct x86_legacy_features { > - enum x86_legacy_i8042_state i8042; /* 0 4 */ > + enum x86_legacy_i8042_state i8042; /* 0 1 */ > + > + /* XXX 3 bytes hole, try to pack */ > + > int rtc; /* 4 4 */ > from arch/x86/include/asm/x86_init.h, the original struct is: So, the size for an enumeration in BTF is in bytes, not in bits, as in CTF, fixed with the patch below, looking at the other cases now. > struct x86_legacy_features { > enum x86_legacy_i8042_state i8042; > int rtc; > int warm_reset; > int no_vga; > int reserve_bios_regions; > struct x86_legacy_devices devices; > }; diff --git a/btf_loader.c b/btf_loader.c index 9922e6d56960..756301f6fcb3 100644 --- a/btf_loader.c +++ b/btf_loader.c @@ -268,7 +268,7 @@ static int create_new_enumeration(struct btf *btf, void *ptr, uint16_t i; struct type *enumeration = type__new(DW_TAG_enumeration_type, btf__get32(btf, &tp->name_off), - size ?: (sizeof(int) * 8)); + size ? size * 8 : (sizeof(int) * 8)); if (enumeration == NULL) return -ENOMEM;