[05/17] ctf-reader: Do not set data member offsets for unions

Message ID 20240716145541.473065-6-dodji@redhat.com
State New
Headers
Series Support self comparison of vmlinux & modules using BTF/CTF |

Commit Message

Dodji Seketeli July 16, 2024, 2:55 p.m. UTC
  From: Dodji Seketeli <dodji@redhat.com>

All union data members should have an offset set to 0.  It turns out
the CTF reader unnecessarily sets the data member offset.  This patch
fixes that.

	* src/abg-ctf-reader.cc (process_ctf_sou_members): Do not set any
	union data member offset.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 src/abg-ctf-reader.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/src/abg-ctf-reader.cc b/src/abg-ctf-reader.cc
index 4b6c6cd8..3dc09b29 100644
--- a/src/abg-ctf-reader.cc
+++ b/src/abg-ctf-reader.cc
@@ -1087,7 +1087,7 @@  process_ctf_sou_members(reader *rdr,
                            public_access,
                            true /* is_laid_out */,
                            false /* is_static */,
-                           membinfo.ctm_offset);
+                           is_union_type(sou) ? 0 : membinfo.ctm_offset);
     }
   if (ctf_errno(ctf_dictionary) != ECTF_NEXT_END)
     fprintf(stderr, "ERROR from ctf_member_next\n");