Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Oct 2014 17:21:22 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r371285 - in head/devel/powerpc64-gcc: . files
Message-ID:  <201410201721.s9KHLMG8093874@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew (src committer)
Date: Mon Oct 20 17:21:21 2014
New Revision: 371285
URL: https://svnweb.freebsd.org/changeset/ports/371285
QAT: https://qat.redports.org/buildarchive/r371285/

Log:
  Allow devel/powerpc64-gcc to be used to target non-FreeBSD ports.
  
   * The format extension patch should only be used on FreeBSD.
   * The name of the target may not follow the portbld scheme.
  
  Differential Revision:	https://reviews.freebsd.org/D972
  Approved by:	bapt

Added:
  head/devel/powerpc64-gcc/files/freebsd-format-extensions
     - copied unchanged from r371281, head/devel/powerpc64-gcc/files/patch-format-extensions
Deleted:
  head/devel/powerpc64-gcc/files/patch-format-extensions
Modified:
  head/devel/powerpc64-gcc/Makefile

Modified: head/devel/powerpc64-gcc/Makefile
==============================================================================
--- head/devel/powerpc64-gcc/Makefile	Mon Oct 20 17:18:18 2014	(r371284)
+++ head/devel/powerpc64-gcc/Makefile	Mon Oct 20 17:21:21 2014	(r371285)
@@ -26,14 +26,22 @@ RUN_DEPENDS=	${PKGNAMEPREFIX}${OPSYS:tl}
 PATCH_WRKSRC=	${WRKDIR}/${PORTNAME}-${PORTVERSION}
 WRKSRC=	${WRKDIR}/build-gcc
 
+.if empty(GCC_TARGET)
+# We are building for a FreeBSD target
+GCC_TARGET=	${PKGNAMEPREFIX}portbld-${OPSYS:tl}${OSREL}
+BU_PREFIX=	${PKGNAMEPREFIX}${OPSYS:tl}
+EXTRA_PATCHES+= ${FILESDIR}/freebsd-format-extensions
+.else
+BU_PREFIX=	${GCC_TARGET}
+.endif
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	--target=${PKGNAMEPREFIX}portbld-${OPSYS:tl}${OSREL} --disable-nls --enable-languages=c,c++ \
+CONFIGURE_ARGS=	--target=${GCC_TARGET} --disable-nls --enable-languages=c,c++ \
 		--without-headers --disable-shared \
 		--with-gmp=${LOCALBASE} \
 		--with-pkgversion="FreeBSD Ports Collection for ${PKGNAMEPREFIX:C/-//g}" \
 		--with-system-zlib \
-		--with-as=${LOCALBASE}/bin/${PKGNAMEPREFIX}${OPSYS:tl}-as \
-		--with-ld=${LOCALBASE}/bin/${PKGNAMEPREFIX}${OPSYS:tl}-ld
+		--with-as=${LOCALBASE}/bin/${BU_PREFIX}-as \
+		--with-ld=${LOCALBASE}/bin/${BU_PREFIX}-ld
 
 CONFIGURE_SCRIPT=	../${PORTNAME}-${PORTVERSION}/configure
 

Copied: head/devel/powerpc64-gcc/files/freebsd-format-extensions (from r371281, head/devel/powerpc64-gcc/files/patch-format-extensions)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/powerpc64-gcc/files/freebsd-format-extensions	Mon Oct 20 17:21:21 2014	(r371285, copy of r371281, head/devel/powerpc64-gcc/files/patch-format-extensions)
@@ -0,0 +1,117 @@
+Index: gcc/c-family/c-format.c
+===================================================================
+--- gcc/c-family/c-format.c	(revision 216017)
++++ gcc/c-family/c-format.c	(working copy)
+@@ -622,6 +622,26 @@
+   { NULL,  0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
+ };
+ 
++static const format_char_info fbsd_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[] =
++{
++  /* BSD conversion specifiers.  */
++  /* 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, "<base><arg>*");
++     which produces:	reg=3<BITTWO,BITONE>
++     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 },
++  { "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.  */
+@@ -872,6 +892,12 @@
+     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
+   }
+ };
+ 
+@@ -1426,6 +1452,9 @@
+ 
+   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)
+@@ -1926,6 +1955,14 @@
+ 	  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);
+@@ -1993,6 +2030,14 @@
+       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)
+ 	{
+ 	  if (ISGRAPH (format_char))
+Index: gcc/c-family/c-format.h
+===================================================================
+--- gcc/c-family/c-format.h	(revision 216017)
++++ gcc/c-family/c-format.h	(working copy)
+@@ -75,11 +75,12 @@
+   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
+Index: gcc/config/freebsd.opt
+===================================================================
+--- gcc/config/freebsd.opt	(revision 216017)
++++ gcc/config/freebsd.opt	(working copy)
+@@ -34,6 +34,10 @@
+ defsym=
+ Driver JoinedOrMissing
+ 
++fformat-extensions
++Common Report Var(flag_format_extensions) Init(0)
++Allow FreeBSD kernel-specific printf format specifiers.
++
+ posix
+ Driver
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410201721.s9KHLMG8093874>