From nobody Fri Nov 18 21:38:00 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NDVWY1F94z4hNdl; Fri, 18 Nov 2022 21:38:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NDVWY0kwGz3wx8; Fri, 18 Nov 2022 21:38:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668807481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0z/lS9/x1k6EwOE7vE3TDdkVvcpEx3Rc9q5F5x6roDc=; b=f0Q8WhAVpGg5FEUtMcAiPCQyGRAfKG6SMwE5dAZp3ZBfwGo4ZbOlPMtp8Z501ZqlB2zdlE 7qRoUj8/vHdx2q1WQnA0UoporBLlJxC1jeRZOSd9PdK7oANCWECZct90X4L8+1p3zA/Gvb AaI1xV7bFwsfuOQXf0rT/AvXhfst49ykRQB0GVrHsDaEQxLfPS1U6BMW+KZSEhc+8RGoOY vLaG0Zz1W+V56Wcj9X3j6TstWRwKm/ITFu0FvFJSM392LTproeWVCDsHTj+F2v7aG5N2xa YvU05oKFlTDfbIxqTqlLWnzGNdlkddS3tb1TvupsOZ3/aOlhD++a1+D0zOUqjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668807481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0z/lS9/x1k6EwOE7vE3TDdkVvcpEx3Rc9q5F5x6roDc=; b=BBrcfPt06/PMzVXHthvRkfsOkVmrql889wEqDFURwb5uXzE9MSn5ks4QxP6kJIk9e5/crN lBtzzwyqWFeLu85+8ttL5xzQ1KIOiUmgEvJRImD6NvNIGwTjCl+LdSCu2zAtm/0xI7D76o X0iSHI7Gw7GREjYVoDJsgYyYqYstFrZu4li+TxzCOOCIpenR3zExumd8VzAUiiyCxeNSMJ OCmcW0mf/DYcWeQrbFp+31KZDJlSWGlwVOCp10WZVBVLsUPX5ar00GQnqmpJEVXDHaYTpn y+mV0xmckfSw92Wv/e1Cva7AAVQarcOiJUCMK55rCp/x9b244FEHJOkzxK+zdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668807481; a=rsa-sha256; cv=none; b=P9QZkCr2t45yEiZkrtt8sWtjr9h80GA0apMEOUZKnl2nPxjwfp7Jn2bt0UlNytoldaLVr/ qxBQ+2FduqYY74X+Uh21xu8cw4VXOcyJmoe0T8rjOQurF4dk2Ms80Y9vQJtyoYoZ0OiwZ4 +gnaKUHZgsWKeUqTAs0mgIc7SH7eTWmCn30lC10otoL8oZeROkWRs40GUtNKmmdrioHZM2 P1WRA5UCIDuImbksVItNKObLNgwZ+SvwoS4z1FnaukleNwoFYTQ5VOsn7HP3N5yCpD4AK7 HyXzX43BJZ+TJ1VAewRz0G3n6B09IR2MJ7/JqdbH+TSbQaYSBPwPqWXWgJkDJg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NDVWX6nJ2zM7r; Fri, 18 Nov 2022 21:38:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AILc09X000624; Fri, 18 Nov 2022 21:38:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AILc0ZH000623; Fri, 18 Nov 2022 21:38:00 GMT (envelope-from git) Date: Fri, 18 Nov 2022 21:38:00 GMT Message-Id: <202211182138.2AILc0ZH000623@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: John Baldwin Subject: git: 91431b0114be - main - devel/freebsd-gcc12: Fix support for FreeBSD kernel printf. List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 91431b0114be7f4c380829f1ff7c4f9252adbba1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb (doc, src committer): URL: https://cgit.FreeBSD.org/ports/commit/?id=91431b0114be7f4c380829f1ff7c4f9252adbba1 commit 91431b0114be7f4c380829f1ff7c4f9252adbba1 Author: John Baldwin AuthorDate: 2022-11-18 21:37:25 +0000 Commit: John Baldwin CommitDate: 2022-11-18 21:37:25 +0000 devel/freebsd-gcc12: Fix support for FreeBSD kernel printf. Remove -fformat-extensions and instead follow clang and add a new format type: __freebsd_kprintf__. This permits removing unsupported width specifies such as 'D' which conflict with the local %D specifier used in the kernel which the old -fformat-extensions did not handle. --- devel/freebsd-gcc12/Makefile | 1 + .../files/patch-freebsd-format-extensions | 101 ++++++++++----------- 2 files changed, 50 insertions(+), 52 deletions(-) diff --git a/devel/freebsd-gcc12/Makefile b/devel/freebsd-gcc12/Makefile index 7727bf99aa44..4a9bd5abe2e2 100644 --- a/devel/freebsd-gcc12/Makefile +++ b/devel/freebsd-gcc12/Makefile @@ -1,5 +1,6 @@ PORTNAME= gcc PORTVERSION= 12.1.0 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= GCC PKGNAMEPREFIX= ${TARGETARCH}- diff --git a/devel/freebsd-gcc12/files/patch-freebsd-format-extensions b/devel/freebsd-gcc12/files/patch-freebsd-format-extensions index 197ba7fa50d8..7bce7950c4db 100644 --- a/devel/freebsd-gcc12/files/patch-freebsd-format-extensions +++ b/devel/freebsd-gcc12/files/patch-freebsd-format-extensions @@ -1,15 +1,48 @@ --- gcc/c-family/c-format.cc.orig 2022-05-06 00:30:56.000000000 -0700 -+++ gcc/c-family/c-format.cc 2022-05-20 13:56:43.632917000 -0700 -@@ -721,6 +721,26 @@ static const format_char_info print_char_table[] = ++++ gcc/c-family/c-format.cc 2022-11-18 11:27:29.832693000 -0800 +@@ -496,6 +496,17 @@ static const format_length_info printf_length_specs[] + { NO_FMT, NO_FMT, 0 } + }; + ++static const format_length_info freebsd_kprintf_length_specs[] = ++{ ++ { "h", FMT_LEN_h, STD_C89, "hh", FMT_LEN_hh, STD_C99, 0 }, ++ { "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C9L, 0 }, ++ { "q", FMT_LEN_ll, STD_EXT, NO_FMT, 0 }, ++ { "z", FMT_LEN_z, STD_C99, NO_FMT, 0 }, ++ { "t", FMT_LEN_t, STD_C99, NO_FMT, 0 }, ++ { "j", FMT_LEN_j, STD_C99, NO_FMT, 0 }, ++ { NO_FMT, NO_FMT, 0 } ++}; ++ + /* Length specifiers valid for asm_fprintf. */ + static const format_length_info asm_fprintf_length_specs[] = + { +@@ -721,6 +732,41 @@ static const format_char_info print_char_table[] = { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } }; -+static const format_char_info fbsd_ext_char_info = ++static const format_char_info freebsd_ext_char_info = +{ NULL, 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "cR", NULL }; + -+static const format_char_info fbsd_print_char_table[] = ++static const format_char_info freebsd_kprintf_char_table[] = +{ -+ /* BSD conversion specifiers. */ ++ /* C89 conversion specifiers. */ ++ { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "-wp0 +'I", "i", NULL }, ++ { "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0#", "i", NULL }, ++ { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM, BADLEN, BADLEN, BADLEN }, "-wp0'I", "i", NULL }, ++ { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL }, ++ { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#I", "", NULL }, ++ { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL }, ++ { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", NULL }, ++ { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c", NULL }, ++ { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL }, ++ /* C99 conversion specifiers. */ ++ { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#'I", "", NULL }, ++ { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, T2X_D32, T2X_D64, T2X_D128 }, "-wp0 +#", "", NULL }, ++ /* X/Open conversion specifiers. */ ++ { "C", 0, STD_EXT, { TEX_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL }, ++ { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL }, + /* FreeBSD kernel extensions (src/sys/kern/subr_prf.c). + The format %b is supported to decode error registers. + Its usage is: printf("reg=%b\n", regval, "*"); @@ -18,8 +51,8 @@ + ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX + ("%*D", len, ptr, " ") -> XX XX XX XX ... + */ -+ { "D", 1, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", &fbsd_ext_char_info }, -+ { "b", 0, STD_EXT, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", &fbsd_ext_char_info }, ++ { "D", 1, STD_EXT, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR", &freebsd_ext_char_info }, ++ { "b", 0, STD_EXT, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "", &freebsd_ext_char_info }, + { "ry", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "i", NULL }, + { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL } +}; @@ -27,7 +60,7 @@ static const format_char_info asm_fprintf_char_table[] = { /* C89 conversion specifiers. */ -@@ -991,6 +1011,12 @@ static const format_kind_info format_types_orig[] = +@@ -991,6 +1037,18 @@ static const format_kind_info format_types_orig[] = strfmon_flag_specs, strfmon_flag_pairs, FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L', 0, NULL, NULL @@ -36,11 +69,17 @@ + printf_flag_specs, printf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_NULL_FORMAT_OK, + 'w', 0, 'p', 0, 'L', 0, ++ &integer_type_node, &integer_type_node ++ }, ++ { "freebsd_kprintf", freebsd_kprintf_length_specs, freebsd_kprintf_char_table, " +#0-'", NULL, ++ printf_flag_specs, printf_flag_pairs, ++ FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, ++ 'w', 0, 'p', 0, 'L', 0, + &integer_type_node, &integer_type_node } }; -@@ -1635,6 +1661,9 @@ check_format_arg (void *ctx, tree format_tree, +@@ -1635,6 +1693,9 @@ check_format_arg (void *ctx, tree format_tree, if (integer_zerop (format_tree)) { @@ -50,37 +89,8 @@ /* Skip to first argument to check, so we can see if this format has any arguments (it shouldn't). */ while (arg_num + 1 < info->first_arg_num) -@@ -2465,6 +2494,13 @@ argument_parser::read_any_length_modifier () - while (fli->name != 0 - && strncmp (fli->name, format_chars, strlen (fli->name))) - fli++; -+ -+ /* Make sure FreeBSD's D format char takes preference over new DD -+ length specifier if FreeBSD format extensions are requested. */ -+ if (fli->index == FMT_LEN_D && flag_format_extensions -+ && fki->conversion_specs == print_char_table) -+ while (fli->name != 0) -+ fli++; - if (fli->name != 0) - { - format_chars += strlen (fli->name); -@@ -2537,6 +2573,14 @@ argument_parser::find_format_char_info (char format_ch - while (fci->format_chars != 0 - && strchr (fci->format_chars, format_char) == 0) - ++fci; -+ if (fci->format_chars == 0 && flag_format_extensions -+ && fki->conversion_specs == print_char_table) -+ { -+ fci = fbsd_print_char_table; -+ while (fci->format_chars != 0 -+ && strchr (fci->format_chars, format_char) == 0) -+ ++fci; -+ } - if (fci->format_chars == 0) - { - format_warning_at_char (format_string_loc, format_string_cst, --- gcc/c-family/c-format.h.orig 2022-05-06 00:30:56.000000000 -0700 -+++ gcc/c-family/c-format.h 2022-05-20 13:56:43.633782000 -0700 ++++ gcc/c-family/c-format.h 2022-11-17 17:31:38.546594000 -0800 @@ -77,11 +77,12 @@ enum FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128, /* The format arg is an opaque object that will be parsed by an external @@ -95,16 +105,3 @@ }; /* Structure describing a length modifier supported in format checking, and ---- gcc/config/freebsd.opt.orig 2022-05-06 00:30:56.000000000 -0700 -+++ gcc/config/freebsd.opt 2022-05-20 13:56:43.634497000 -0700 -@@ -34,6 +34,10 @@ Driver JoinedOrMissing - defsym= - Driver JoinedOrMissing - -+fformat-extensions -+Common Var(flag_format_extensions) Init(0) -+Allow FreeBSD kernel-specific printf format specifiers. -+ - posix - Driver -