[PATCH pahole] dwarves: add __int128 types in base_type_name_to_size

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

 



Added int128 types to dwarf base_type_name_to_size table
so that the correct base type size can be retrieved in certain
cases. Note that for type "unsigned __int128", the dwarf in gcc
has type name "__int128 unsigned" while clang has
"unsigned __int128".

  -bash-4.4$ cat t.c
  struct t {
        __int128 si128a;
        __int128 si128b;
        unsigned __int128 bits3:3;
        unsigned __int128 bits80:80;
        unsigned __int128 ui128;
  } g;
  -bash-4.4$ clang -O2 -c -g -target bpf -Xclang -target-feature -Xclang +dwarfris t.c
  -bash-4.4$ pahole -F dwarf t.o
  struct t {
        __int128                   si128a;               /*     0    16 */
        __int128                   si128b;               /*    16    16 */
        unsigned __int128          bits3:3;              /*    32:125 16 */
        unsigned __int128          bits80:80;            /*    32:45 16 */

        /* XXX 45 bits hole, try to pack */

        unsigned __int128          ui128;                /*    48    16 */

        /* size: 64, cachelines: 1, members: 5 */
        /* bit holes: 1, sum bit holes: 45 bits */
  };
  -bash-4.4$ pahole -F btf t.o
  struct t {
        __int128                   si128a;               /*     0    16 */
        __int128                   si128b;               /*    16    16 */
        unsigned __int128          bits3:3;              /*    32:125 16 */
        unsigned __int128          bits80:80;            /*    32:45 16 */

        /* XXX 45 bits hole, try to pack */

        unsigned __int128          ui128;                /*    48    16 */

        /* size: 64, cachelines: 1, members: 5 */
        /* bit holes: 1, sum bit holes: 45 bits */
  };
  -bash-4.4$ pahole -JV t.o
  File t.o:
  [1] STRUCT t kind_flag=1 size=64 vlen=5
        si128a type_id=2 bitfield_size=0 bits_offset=0
        si128b type_id=2 bitfield_size=0 bits_offset=128
        bits3 type_id=3 bitfield_size=3 bits_offset=256
        bits80 type_id=3 bitfield_size=80 bits_offset=259
        ui128 type_id=3 bitfield_size=0 bits_offset=384
  [2] INT __int128 size=16 bit_offset=0 nr_bits=128 encoding=SIGNED
  [3] INT unsigned __int128 size=16 bit_offset=0 nr_bits=128 encoding=(none)
  [4] INT (anon) size=4 bit_offset=0 nr_bits=32 encoding=(none)
  -bash-4.4$

Signed-off-by: Yonghong Song <yhs@xxxxxx>
---
 dwarves.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dwarves.c b/dwarves.c
index 0f7e367..1afd85c 100644
--- a/dwarves.c
+++ b/dwarves.c
@@ -169,6 +169,9 @@ static struct base_type_name_to_size {
 	{ .name = "float",		    .size = 32, },
 	{ .name = "long double",	    .size = 64, },
 	{ .name = "long double long double", .size = 64, },
+	{ .name = "__int128",		    .size = 128, },
+	{ .name = "unsigned __int128",	    .size = 128, },
+	{ .name = "__int128 unsigned",	    .size = 128, },
 	{ .name = NULL },
 };
 
-- 
2.17.1




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

  Powered by Linux