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,153 +1,154 @@ PORTNAME= gcc PORTVERSION= 12.1.0 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= GCC PKGNAMEPREFIX= ${TARGETARCH}- PKGNAMESUFFIX= ${SUFFIX} MAINTAINER= jhb@FreeBSD.org COMMENT= Cross GNU Compiler Collection for ${TARGETARCH} WWW= https://gcc.gnu.org/ LICENSE= GPLv3 GPLv3RLE LICENSE_COMB= multi IGNORE_FreeBSD_12= Not supported on FreeBSD 12 BUILD_DEPENDS= ${BU_PREFIX}-as:devel/binutils@${BU_FLAVOR} \ objdump:devel/binutils LIB_DEPENDS= libgmp.so:math/gmp \ libmpfr.so:math/mpfr \ libmpc.so:math/mpc RUN_DEPENDS= ${BU_PREFIX}-as:devel/binutils@${BU_FLAVOR} FLAVORS= aarch64 amd64 armv6 armv7 i386 powerpc powerpc64 riscv64 TARGETARCH= ${FLAVOR} USES= compiler:c++11-lang cpe gmake iconv libtool makeinfo tar:xz CPE_VENDOR= gnu PLIST_SUB= OPSYS=${OPSYS:tl} \ SUFFIX=${SUFFIX} \ TARGETARCH=${TARGETARCH} \ GCC_TARGET=${GCC_TARGET} \ GCC_VERSION=${PORTVERSION} SUB_FILES= xtoolchain.mk SUB_LIST= BU_PREFIX=${BU_PREFIX} \ GCC_TARGET=${GCC_TARGET} \ SUFFIX=${SUFFIX} SUFFIX= ${PORTVERSION:C/([0-9]+).*/\1/} GNU_CONFIGURE= yes CONFIGURE_OUTSOURCE= yes CONFIGURE_ARGS+=--target=${GCC_TARGET} --disable-nls --enable-languages=c,c++ \ --enable-gnu-indirect-function \ --enable-initfini-array \ --program-prefix=${GCC_TARGET}- \ --program-suffix=${SUFFIX} \ --without-headers \ --with-gmp=${LOCALBASE} \ --with-pkgversion="FreeBSD Ports Collection for ${PKGNAMEPREFIX:C/-//g}" \ --with-system-zlib \ --without-zstd \ --with-gxx-include-dir=/usr/include/c++/v1/ \ --with-sysroot="/" \ --with-as=${LOCALBASE}/bin/${BU_PREFIX}-as \ --with-ld=${LOCALBASE}/bin/${BU_PREFIX}-ld .if ${TARGETARCH:Mpowerpc64*} CONFIGURE_ARGS+=--with-abi=elfv2 .endif ALL_TARGET= all-gcc INSTALL_TARGET= install-gcc .include .if ${TARGETARCH:Marm*} TARGET_ABI= gnueabi BU_FLAVOR= arm_${TARGET_ABI} BU_PREFIX= arm-${TARGET_ABI}-${OPSYS:tl}${OSREL} .else TARGET_ABI= unknown BU_FLAVOR= ${TARGETARCH} BU_PREFIX= ${GCC_TARGET} .endif GCC_TARGET= ${TARGETARCH:S/amd64/x86_64/}-${TARGET_ABI}-${OPSYS:tl}${OSREL} post-patch: @${REINPLACE_CMD} -e '/LIBSTDCXX/ s/stdc\+\+/c\+\+/g ' \ ${WRKSRC}//gcc/cp/g++spec.cc @${REINPLACE_CMD} -e '/LOCAL_INCLUDE_DIR/ d ' \ ${WRKSRC}//gcc/Makefile.in .if ${ARCH} == "amd64" CONFIGURE_TARGET= x86_64-unknown-${OPSYS:tl}${OSREL} .else CONFIGURE_TARGET= ${ARCH}-unknown-${OPSYS:tl}${OSREL} .endif .if ${TARGETARCH:Marm*} || ${TARGETARCH} == "aarch64" . if ${CHOSEN_COMPILER_TYPE} == clang MAKE_ARGS+=CXXFLAGS=-fbracket-depth=512 . endif .endif .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "powerpc64" CONFIGURE_ARGS+=--enable-multilib .endif .if ${ARCH} == "aarch64" PLIST_SUB+= PLUGINS="@comment plugin does not build" .else PLIST_SUB+= PLUGINS="" .endif .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "i386" PLIST_SUB+= FLOAT_H="@comment " .else PLIST_SUB+= FLOAT_H="" .endif PLIST= ${.CURDIR}/pkg-plist .if ${TARGETARCH} == "aarch64" PLIST+= ${.CURDIR}/pkg-plist.aarch64 .endif .if ${TARGETARCH} == "aarch64" || ${TARGETARCH:Marm*} PLIST+= ${.CURDIR}/pkg-plist.arm .endif .if ${TARGETARCH:Marm*} PLIST+= ${.CURDIR}/pkg-plist.arm_gnueabi .endif .if ${TARGETARCH} == "amd64" PLIST+= ${.CURDIR}/pkg-plist.amd64 .endif .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "i386" PLIST+= ${.CURDIR}/pkg-plist.i386 .endif .if ${TARGETARCH:Mpowerpc64*} PLIST+= ${.CURDIR}/pkg-plist.powerpc64 .elif ${TARGETARCH:Mpowerpc*} PLIST+= ${.CURDIR}/pkg-plist.powerpc .endif .if ${TARGETARCH:Mriscv*} PLIST+= ${.CURDIR}/pkg-plist.riscv .endif post-install: @${RM} ${STAGEDIR}${PREFIX}/bin/${GCC_TARGET}-${GCC_TARGET}-* @${RM} ${STAGEDIR}${PREFIX}/share/info/* @${RM} ${STAGEDIR}${PREFIX}/man/man7/* @${RM} -r ${STAGEDIR}${PREFIX}/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include-fixed .if ${TARGETARCH} == "amd64" || ${TARGETARCH} == "i386" # Conflicts with sys/x86/include/float.h ${RM} ${STAGEDIR}${PREFIX}/lib/gcc/${GCC_TARGET}/${PORTVERSION}/include/float.h .endif ${MKDIR} ${STAGEDIR}${PREFIX}/share/toolchains/ ${INSTALL_DATA} ${WRKDIR}/xtoolchain.mk \ ${STAGEDIR}${PREFIX}/share/toolchains/${TARGETARCH}-gcc${SUFFIX}.mk .include 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,110 +1,107 @@ --- 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, "*"); + which produces: reg=3 + The format %D provides a hexdump given a pointer and separator string: + ("%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 } +}; + 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 + }, + { "printf0", printf_length_specs, print_char_table, " +#0-'I", NULL, + 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)) { + if (!(format_types[info->format_type].flags & FMT_FLAG_NULL_FORMAT_OK)) + warning (OPT_Wformat_, "null format string"); + /* 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 facility. */ - FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256 + FMT_FLAG_PARSE_ARG_CONVERT_EXTERNAL = 256, /* Not included here: details of whether width or precision may occur (controlled by width_char and precision_char); details of whether '*' can be used for these (width_type and precision_type); details of whether length modifiers can occur (length_char_specs). */ + FMT_FLAG_NULL_FORMAT_OK = 512 }; /* 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 -