```9312 ctf: be less clever about skipping 'extern' variables declarations
9864 DWARF->CTF enum conversion needs to be careful of sign```
```*** 861,875 ****
}

el = xcalloc(sizeof (elist_t));
el->el_name = die_name(dw, mem);

!                         if (die_signed(dw, mem, DW_AT_const_value, &sval, 0)) {
!                                 el->el_number = sval;
!                         } else if (die_unsigned(dw, mem, DW_AT_const_value,
&uval, 0)) {
el->el_number = uval;
} else {
terminate("die %llu: enum %llu: member without "
"value\n", off, die_off(dw, mem));
}

--- 861,883 ----
}

el = xcalloc(sizeof (elist_t));
el->el_name = die_name(dw, mem);

!                         /*
!                          * We have to be careful here: newer GCCs generate DWARF
!                          * where an unsigned value will happily pass
!                          * die_signed().  Since negative values will fail
!                          * die_unsigned(), we try that first to make sure we get
!                          * the right value.
!                          */
!                         if (die_unsigned(dw, mem, DW_AT_const_value,
&uval, 0)) {
el->el_number = uval;
+                         } else if (die_signed(dw, mem, DW_AT_const_value,
+                             &sval, 0)) {
+                                 el->el_number = sval;
} else {
terminate("die %llu: enum %llu: member without "
"value\n", off, die_off(dw, mem));
}

*** 1641,1653 ****
iidesc_t *ii;
char *name;

debug(3, "die %llu: creating object definition\n", off);

!         if (die_isdecl(dw, die) || (name = die_name(dw, die)) == NULL)
!                 return; /* skip prototypes and nameless objects */

ii = xcalloc(sizeof (iidesc_t));
ii->ii_type = die_isglobal(dw, die) ? II_GVAR : II_SVAR;
ii->ii_name = name;
ii->ii_dtype = die_lookup_pass1(dw, die, DW_AT_type);
if (ii->ii_type == II_SVAR)
--- 1649,1687 ----
iidesc_t *ii;
char *name;

debug(3, "die %llu: creating object definition\n", off);

!         /* Skip "Non-Defining Declarations" */
!         if (die_isdecl(dw, die))
!                 return;

+         /*
+          * If we find a DIE of "Declarations Completing Non-Defining
+          * Declarations", we will use the referenced type's DIE.  This isn't
+          * quite correct, e.g. DW_AT_decl_line will be the forward declaration
+          * not this site.  It's sufficient for what we need, however: in
+          * particular, we should find DW_AT_external as needed there.
+          */
+         if (die_attr(dw, die, DW_AT_specification, 0) != NULL) {
+                 Dwarf_Die sdie;
+                 Dwarf_Off soff;
+
+                 soff = die_attr_ref(dw, die, DW_AT_specification);
+
+                 if (dwarf_offdie(dw->dw_dw, soff,
+                     &sdie, &dw->dw_err) != DW_DLV_OK) {
+                         terminate("dwarf_offdie(%llu) failed: %s\n",
+                             soff, dwarf_errmsg(dw->dw_err));
+                 }
+
+                 die = sdie;
+         }
+
+         if ((name = die_name(dw, die)) == NULL)
+                 return;
+
ii = xcalloc(sizeof (iidesc_t));
ii->ii_type = die_isglobal(dw, die) ? II_GVAR : II_SVAR;
ii->ii_name = name;
ii->ii_dtype = die_lookup_pass1(dw, die, DW_AT_type);
if (ii->ii_type == II_SVAR)
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.5423421,"math_prob":0.9896564,"size":2605,"snap":"2023-40-2023-50","text_gpt3_token_len":831,"char_repetition_ratio":0.1195694,"word_repetition_ratio":0.25742576,"special_character_ratio":0.37543187,"punctuation_ratio":0.26947367,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9740886,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-10-04T22:13:49Z\",\"WARC-Record-ID\":\"<urn:uuid:790c9169-9e3f-48fb-b14c-beb39cef285d>\",\"Content-Length\":\"8080\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f6750201-4699-464c-b19a-184db5420147>\",\"WARC-Concurrent-To\":\"<urn:uuid:8d0d1e7d-3e32-4aeb-b37d-341c9ea22695>\",\"WARC-IP-Address\":\"44.241.36.226\",\"WARC-Target-URI\":\"https://cr.illumos.org/~webrev/jlevon/9312/usr/src/tools/ctf/cvt/dwarf.c.cdiff.html\",\"WARC-Payload-Digest\":\"sha1:PJYQWBIYNMQWDW7OHVH4NSD2B6YZGTUA\",\"WARC-Block-Digest\":\"sha1:FRE2ODGN55TMZB46RGBTVBEZJD73RECV\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233511424.48_warc_CC-MAIN-20231004220037-20231005010037-00210.warc.gz\"}"}