dwarves: add __int128 types in base_type_name_to_size
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$ Committer testing: Before: $ cat __int128.c struct t { __int128 si128a; __int128 si128b; unsigned __int128 bits3:3; unsigned __int128 bits80:80; unsigned __int128 ui128; } g; $ clang -O2 -c -g -target bpf -Xclang -target-feature -Xclang +dwarfris __int128.c $ pahole __int128.o base_type__name_to_size: base_type unsigned __int128 base_type__name_to_size: base_type unsigned __int128 struct t { __int128 si128a; /* 0 16 */ __int128 si128b; /* 16 16 */ unsigned __int128 bits3:3; /* 32:125 0 */ unsigned __int128 bits80:80; /* 32:45 0 */ /* XXX 173 bits hole, try to pack */ /* XXX 16 bytes hole, try to pack */ unsigned __int128 ui128; /* 48 16 */ /* size: 64, cachelines: 1, members: 5 */ /* sum members: 48, holes: 1, sum holes: 16 */ /* bit holes: 1, sum bit holes: 173 bits */ }; $ pahole -J __int128.o base_type__name_to_size: base_type unsigned __int128 base_type__name_to_size: base_type unsigned __int128 After: $ pahole -F dwarf __int128.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 */ }; $ $ pahole -J __int128.o $ pahole -F btf __int128.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 */ }; $ Signed-off-by: Yonghong Song <yhs@fb.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexei Starovoitov <ast@fb.com> Cc: Martin KaFai Lau <kafai@fb.com> Cc: dwarves@vger.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
de3459cc0e
commit
b79db4cab4
|
@ -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 },
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue