[PATCH v2 pahole 1/7] dwarf_loader: don't recode enums and use real enum size in calculations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch disables bitfield recoding logic in DWARF loader.
This logic is already disabled during DWARF->BTF conversion and without
it pahole reliably produces correct BTF bitfield offsets.

If this functionality is enabled, we are losing correct enum size
information. So let's disable and probably eventually remove it altogether.

Signed-off-by: Andrii Nakryiko <andriin@xxxxxx>
---
 dwarf_loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dwarf_loader.c b/dwarf_loader.c
index 28d1393..cf2aa51 100644
--- a/dwarf_loader.c
+++ b/dwarf_loader.c
@@ -39,7 +39,7 @@ struct strings *strings;
 
 #define hashtags__fn(key) hash_64(key, HASHTAGS__BITS)
 
-bool no_bitfield_type_recode = false;
+bool no_bitfield_type_recode = true;
 
 static void __tag__print_not_supported(uint32_t tag, const char *func)
 {
@@ -2130,7 +2130,7 @@ static int class_member__cache_byte_size(struct tag *tag, struct cu *cu,
 
 		if (tag__is_enumeration(type)) {
 			type_bit_size = tag__type(type)->size;
-			integral_bit_size = sizeof(int) * 8; /* FIXME: always this size? */
+			integral_bit_size = (type_bit_size + 7) / 8 * 8;
 		} else {
 			struct base_type *bt = tag__base_type(type);
 			type_bit_size = bt->bit_size;
-- 
2.17.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux