svn commit: r334883 - head/cddl/contrib/opensolaris/tools/ctf/cvt
Bryan Drewery
bdrewery at FreeBSD.org
Sat Jun 9 17:56:23 UTC 2018
On 6/9/18 1:39 PM, Mark Johnston wrote:
> On Sat, Jun 09, 2018 at 07:35:00PM +0200, O. Hartmann wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA512
>>
>> Am Sat, 9 Jun 2018 15:10:49 +0000 (UTC)
>> Mark Johnston <markj at FreeBSD.org> schrieb:
>>
>>> Author: markj
>>> Date: Sat Jun 9 15:10:49 2018
>>> New Revision: 334883
>>> URL: https://svnweb.freebsd.org/changeset/base/334883
>>>
>>> Log:
>>> Don't process DWARF generated from non-C/C++ code.
>>>
>>> ctfconvert(1) is not designed to handle DWARF generated from such code,
>>> and will generally fail in non-obvious ways. Use an explicit check to
>>> help catch such potential failures.
>>>
>>> Reported by: Johannes Lundberg <johalun0 at gmail.com>
>>> MFC after: 2 weeks
>>>
>>> Modified:
>>> head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
>>>
>>> Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
>>> ==============================================================================
>>> --- head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c Sat Jun 9 15:10:39
>>> 2018 (r334882) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
>>> Sat Jun 9 15:10:49 2018 (r334883) @@ -1901,7 +1901,7 @@ should_have_dwarf(Elf
>>> *elf) int
>>> dw_read(tdata_t *td, Elf *elf, char *filename __unused)
>>> {
>>> - Dwarf_Unsigned abboff, hdrlen, nxthdr;
>>> + Dwarf_Unsigned abboff, hdrlen, lang, nxthdr;
>>> Dwarf_Half vers, addrsz, offsz;
>>> Dwarf_Die cu = 0;
>>> Dwarf_Die child = 0;
>>> @@ -1941,8 +1941,8 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused
>>> }
>>>
>>> if ((rc = dwarf_next_cu_header_b(dw.dw_dw, &hdrlen, &vers, &abboff,
>>> - &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) {
>>> - if (dw.dw_err.err_error == DW_DLE_NO_ENTRY)
>>> + &addrsz, &offsz, NULL, &nxthdr, &dw.dw_err)) != DW_DLV_OK) {
>>> + if (dw.dw_err.err_error == DW_DLE_NO_ENTRY)
>>> exit(0);
>>> else
>>> terminate("rc = %d %s\n", rc, dwarf_errmsg(dw.dw_err));
>>> @@ -1971,6 +1971,25 @@ dw_read(tdata_t *td, Elf *elf, char *filename __unused
>>> debug(1, "DWARF emitter: %s\n", prod);
>>> free(prod);
>>> }
>>> +
>>> + if (dwarf_attrval_unsigned(cu, DW_AT_language, &lang, &dw.dw_err) == 0)
>>> + switch (lang) {
>>> + case DW_LANG_C:
>>> + case DW_LANG_C89:
>>> + case DW_LANG_C99:
>>> + case DW_LANG_C11:
>>> + case DW_LANG_C_plus_plus:
>>> + case DW_LANG_C_plus_plus_03:
>>> + case DW_LANG_C_plus_plus_11:
>>> + case DW_LANG_C_plus_plus_14:
>>> + break;
>>> + default:
>>> + terminate("file contains DWARF for unsupported "
>>> + "language %d", lang);
>>> + }
>>> + else
>>> + warning("die %llu: failed to get language attribute: %s\n",
>>> + die_off(&dw, cu), dwarf_errmsg(dw.dw_err));
>>>
>>> if ((dw.dw_cuname = die_name(&dw, cu)) != NULL) {
>>> char *base = xstrdup(basename(dw.dw_cuname));
>>> _______________________________________________
>>> svn-src-head at freebsd.org mailing list
>>> https://lists.freebsd.org/mailman/listinfo/svn-src-head
>>> To unsubscribe, send any mail to "svn-src-head-unsubscribe at freebsd.org"
>> This commit makes buildworld (WITH_META_MODE) failing:
>
> I added these identifiers in r334881, and the CI build is passing. Might
> this be a problem with META_MODE?
>
>> [...]
>> ===> cddl/usr.bin/ctfconvert (obj,all,install)
>> Building /usr/obj/usr/src/amd64.amd64/tmp/obj-tools/cddl/usr.bin/ctfconvert/dwarf.o
obj-tools means it is trying to build a HOST NATIVE version of this.
Where are these defined? In this case they need to be defined in
/usr/include already unless the build has -I.CURDIR/somewhere/to/headers
instead.
>> - --- dwarf.o ---
>> /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1980:8: error: use of undeclared
>> identifier 'DW_LANG_C11' case DW_LANG_C11:
>> ^
>> /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1982:8: error: use of undeclared
>> identifier 'DW_LANG_C_plus_plus_03' case DW_LANG_C_plus_plus_03:
>> ^
>> /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1983:8: error: use of undeclared
>> identifier 'DW_LANG_C_plus_plus_11' case DW_LANG_C_plus_plus_11:
>> ^
>> /usr/src/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c:1984:8: error: use of undeclared
>> identifier 'DW_LANG_C_plus_plus_14' case DW_LANG_C_plus_plus_14:
>> ^
>> 4 errors generated.
>> *** [dwarf.o] Error code 1
--
Regards,
Bryan Drewery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20180609/a9f29ca9/attachment-0001.sig>
More information about the svn-src-head
mailing list