When using systemtap on Go binaries that work around issue 17957 and 17958, systemtap will fail to create the kernel module because the generated C code uses uint0_t types: /tmp/stapUOqJjk/stap_ea1e3b08acea61492ed2615b6f549cbe_535512_src.c: In function ‘function__dwarf_tvar_get__p__261’: /tmp/stapUOqJjk/stap_ea1e3b08acea61492ed2615b6f549cbe_535512_src.c:12640:7: error: unknown type name ‘uint0_t’ { uint0_t value = deref (sizeof addr, addr); addr = value; } ^ /tmp/stapUOqJjk/stap_ea1e3b08acea61492ed2615b6f549cbe_535512_src.c: In function ‘function__dwarf_tvar_get__p__585’: /tmp/stapUOqJjk/stap_ea1e3b08acea61492ed2615b6f549cbe_535512_src.c:12712:7: error: unknown type name ‘uint0_t’ { uint0_t value = deref (sizeof addr, addr); addr = value; } ^ /tmp/stapUOqJjk/stap_ea1e3b08acea61492ed2615b6f549cbe_535512_src.c: In function ‘function__dwarf_tvar_get_addr_647’: /tmp/stapUOqJjk/stap_ea1e3b08acea61492ed2615b6f549cbe_535512_src.c:13060:7: error: unknown type name ‘uint0_t’ { uint0_t value = deref (sizeof addr, addr); addr = value; } ^
Created attachment 8122 [details] Generated src.c.
Added generated src.c.
This seems to be caused by a "sizeless" pointer type. The following quick hack seems to solve the issue: diff --git a/loc2c.c b/loc2c.c index aef999c..b179240 100644 --- a/loc2c.c +++ b/loc2c.c @@ -2132,7 +2132,7 @@ c_translate_pointer (struct obstack *pool, int indent, Dwarf_Attribute attr_mem; Dwarf_Word byte_size; if (dwarf_attr_integrate (typedie, DW_AT_byte_size, &attr_mem) == NULL) - byte_size = 0; + byte_size = max_fetch_size (*input, typedie); else if (dwarf_formudata (&attr_mem, &byte_size) != 0) FAIL (*input, N_("cannot get byte_size attribute for type %s: %s"),
commit 4bfa7779843bda6f74c547a42a092a2974d07b9e Author: Mark Wielaard <mjw@redhat.com> Date: Thu Apr 9 16:51:56 2015 +0200 PR17959 Allow size-less pointer types. golang might produce a DW_TAG_pointer_type without any size. Assume the size of the pointer is equal to the address size of the DWARF CU in that case. Otherwise we might try to create values of type uint0_t.