return -ENOENT;
                }
                /* Verify it is a data structure  */
-               if (dwarf_tag(&type) != DW_TAG_structure_type) {
-                       pr_warning("%s is not a data structure.\n", varname);
+               tag = dwarf_tag(&type);
+               if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
+                       pr_warning("%s is not a data structure nor an union.\n",
+                                  varname);
                        return -EINVAL;
                }
 
                        *ref_ptr = ref;
        } else {
                /* Verify it is a data structure  */
-               if (tag != DW_TAG_structure_type) {
-                       pr_warning("%s is not a data structure.\n", varname);
+               if (tag != DW_TAG_structure_type && tag != DW_TAG_union_type) {
+                       pr_warning("%s is not a data structure nor an union.\n",
+                                  varname);
                        return -EINVAL;
                }
                if (field->name[0] == '[') {
        }
 
        /* Get the offset of the field */
-       ret = die_get_data_member_location(die_mem, &offs);
-       if (ret < 0) {
-               pr_warning("Failed to get the offset of %s.\n", field->name);
-               return ret;
+       if (tag == DW_TAG_union_type) {
+               offs = 0;
+       } else {
+               ret = die_get_data_member_location(die_mem, &offs);
+               if (ret < 0) {
+                       pr_warning("Failed to get the offset of %s.\n",
+                                  field->name);
+                       return ret;
+               }
        }
        ref->offset += (long)offs;