NetBSD Problem Report #53178
From www@NetBSD.org Fri Apr 13 04:18:28 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2AD697A181
for <gnats-bugs@gnats.NetBSD.org>; Fri, 13 Apr 2018 04:18:28 +0000 (UTC)
Message-Id: <20180413041827.051A87A1D0@mollari.NetBSD.org>
Date: Fri, 13 Apr 2018 04:18:26 +0000 (UTC)
From: thorpej@me.com
Reply-To: thorpej@me.com
To: gnats-bugs@NetBSD.org
Subject: Building GCC blows up macOS 10.13.4 clang - need to increase max bracket depth
X-Send-Pr-Version: www-1.0
>Number: 53178
>Category: toolchain
>Synopsis: Building GCC blows up macOS 10.13.4 clang - need to increase max bracket depth
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: maya
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 13 04:20:00 +0000 2018
>Closed-Date: Wed Apr 18 14:06:36 +0000 2018
>Last-Modified: Wed Apr 18 14:06:36 +0000 2018
>Originator: Jason Thorpe
>Release: NetBSD 8.99.14
>Organization:
>Environment:
NetBSD nixie-dev 8.99.14 NetBSD 8.99.14 (thorpej-RPI-NixieClock) #9: Mon Apr 9 21:09:00 PDT 2018 thorpej@BigMac.local:/Volumes/Data0/Users/thorpej/hack/NetBSD/current/src/sys/arch/evbarm/compile/thorpej-RPI-NixieClock evbarm
>Description:
When building on a macOS 10.13.4 host, building the cross GCC for ARM blows up because the neon module makes llvm on the host cranky by exceeding max bracket depth.
>How-To-Repeat:
Attempt to build earmv6hf host tools on macOS.
>Fix:
Index: tools/Makefile.gnuhost
===================================================================
RCS file: /cvsroot/src/tools/Makefile.gnuhost,v
retrieving revision 1.44
diff -u -p -r1.44 Makefile.gnuhost
--- tools/Makefile.gnuhost 16 Jan 2016 18:38:53 -0000 1.44
+++ tools/Makefile.gnuhost 13 Apr 2018 04:18:11 -0000
@@ -20,7 +20,8 @@
# Disable use of pre-compiled headers on Darwin.
BUILD_OSTYPE!= uname -s
.if ${BUILD_OSTYPE} == "Darwin"
-HOST_CFLAGS+=-O2 -no-cpp-precomp
+HOST_CFLAGS+=-O2 -no-cpp-precomp -fbracket-depth=512
+HOST_CXXFLAGS+= -fbracket-depth=512
.endif
MAKE_PROGRAM?= ${MAKE}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: snj@NetBSD.org
State-Changed-When: Fri, 13 Apr 2018 06:17:43 +0000
State-Changed-Why:
committed. thanks, dude!
From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53178 CVS commit: src/tools
Date: Fri, 13 Apr 2018 06:15:26 +0000
Module Name: src
Committed By: snj
Date: Fri Apr 13 06:15:26 UTC 2018
Modified Files:
src/tools: Makefile.gnuhost
Log Message:
GCC build exceeds the macOS clang default bracket nesting level of 256.
Work around with -fbracket-depth=512.
From potr in PR toolchain/53178.
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/tools/Makefile.gnuhost
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53178 CVS commit: [netbsd-8] src/tools
Date: Sat, 14 Apr 2018 10:44:57 +0000
Module Name: src
Committed By: martin
Date: Sat Apr 14 10:44:56 UTC 2018
Modified Files:
src/tools [netbsd-8]: Makefile.gnuhost
Log Message:
Pull up following revision(s) (requested by maya in ticket #754):
tools/Makefile.gnuhost: revision 1.45
GCC build exceeds the macOS clang default bracket nesting level of 256.
Work around with -fbracket-depth=512.
From potr in PR toolchain/53178.
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.8.1 src/tools/Makefile.gnuhost
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, thorpej@me.com
Subject: Re: PR/53178 CVS commit: src/tools
Date: Sun, 15 Apr 2018 15:18:10 +0200
On Fri, Apr 13, 2018 at 06:20:01AM +0000, Soren Jacobsen wrote:
> The following reply was made to PR toolchain/53178; it has been noted by GNATS.
>
> From: "Soren Jacobsen" <snj@netbsd.org>
> To: gnats-bugs@gnats.NetBSD.org
> Cc:
> Subject: PR/53178 CVS commit: src/tools
> Date: Fri, 13 Apr 2018 06:15:26 +0000
>
> Module Name: src
> Committed By: snj
> Date: Fri Apr 13 06:15:26 UTC 2018
>
> Modified Files:
> src/tools: Makefile.gnuhost
>
> Log Message:
> GCC build exceeds the macOS clang default bracket nesting level of 256.
> Work around with -fbracket-depth=512.
>
> From potr in PR toolchain/53178.
This is not an appropriate fix. It assumes blindly that the host
compiler is clang on OSX and doesn't address the reverse case of using
clang on non-OSX at all. There is a reason why this patch hasn't been
committed before.
Joerg
From: christos@zoulas.com (Christos Zoulas)
To: Joerg Sonnenberger <joerg@bec.de>, gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, thorpej@me.com
Subject: Re: PR/53178 CVS commit: src/tools
Date: Sun, 15 Apr 2018 10:25:21 -0400
On Apr 15, 3:18pm, joerg@bec.de (Joerg Sonnenberger) wrote:
-- Subject: Re: PR/53178 CVS commit: src/tools
| This is not an appropriate fix. It assumes blindly that the host
| compiler is clang on OSX and doesn't address the reverse case of using
| clang on non-OSX at all. There is a reason why this patch hasn't been
| committed before.
I agree, but that ship had already sailed:
@@ -18,9 +18,12 @@
.include <bsd.own.mk>
# Disable use of pre-compiled headers on Darwin.
+# GCC build exceeds the macOS clang default bracket nesting level of 256.
BUILD_OSTYPE!= uname -s
.if ${BUILD_OSTYPE} == "Darwin"
HOST_CFLAGS+=-O2 -no-cpp-precomp
+HOST_CFLAGS+=-O2 -no-cpp-precomp -fbracket-depth=512
+HOST_CXXFLAGS+= -fbracket-depth=512
.endif
MAKE_PROGRAM?= ${MAKE}
"-no-cpp-precomp" is only valid on clang, right?
I mean this did not make the situation any worse...
christos
From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: PR/53178 CVS commit: src/tools
Date: Sun, 15 Apr 2018 10:48:31 -0700
> On Apr 15, 2018, at 7:30 AM, Christos Zoulas <christos@zoulas.com> =
wrote:
>=20
> "-no-cpp-precomp" is only valid on clang, right?
> I mean this did not make the situation any worse=E2=80=A6
I=E2=80=99m pretty sure that flag worked with Xcode-bundled GCCs, as =
well.
But, yes, this doesn=E2=80=99t really make the situation any worse, and =
it=E2=80=99s pretty lame to just leave it totally broken for people =
hosting on recent versions of macOS (and by =E2=80=9Crecent=E2=80=9D, I =
mean anything at ~3 years old and newer).
-- thorpej
From: Joerg Sonnenberger <joerg@bec.de>
To: Christos Zoulas <christos@zoulas.com>
Cc: Joerg Sonnenberger <joerg@bec.de>, gnats-bugs@NetBSD.org,
toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, thorpej@me.com
Subject: Re: PR/53178 CVS commit: src/tools
Date: Sun, 15 Apr 2018 19:50:36 +0200
On Sun, Apr 15, 2018 at 10:25:21AM -0400, Christos Zoulas wrote:
> "-no-cpp-precomp" is only valid on clang, right?
It's a legacy option of Apple's GCC fork. It is silently ignored by
clang. As such, this whole fragment should go. Maya found the correct
upstream change to fix the broken generated C.
Joerg
From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: toolchain/53178 (Building GCC blows up macOS 10.13.4 clang -
need to increase max bracket depth)
Date: Sun, 15 Apr 2018 20:06:46 +0000
To write here as well
here is probably the upstream fix
https://github.com/gcc-mirror/gcc/commit/e3008af501a77da4e9b4b5102d25066427eae376.patch
From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: PR/53178 CVS commit: src/tools
Date: Sun, 15 Apr 2018 10:49:21 -0700
> On Apr 15, 2018, at 6:20 AM, Joerg Sonnenberger <joerg@bec.de> wrote:
>
> This is not an appropriate fix. It assumes blindly that the host
> compiler is clang on OSX and doesn't address the reverse case of using
> clang on non-OSX at all. There is a reason why this patch hasn't been
> committed before.
So provide a better patch?
-- thorpej
State-Changed-From-To: closed->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sun, 15 Apr 2018 21:51:55 +0000
State-Changed-Why:
please retest with https://netbsd.org/~maya/genattrtab
From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, netbsd-bugs@netbsd.org,
gnats-admin@netbsd.org, maya@NetBSD.org
Subject: Re: toolchain/53178 (Building GCC blows up macOS 10.13.4 clang - need
to increase max bracket depth)
Date: Mon, 16 Apr 2018 21:26:16 -0700
> On Apr 15, 2018, at 2:51 PM, maya@netbsd.org wrote:
>=20
> Synopsis: Building GCC blows up macOS 10.13.4 clang - need to increase =
max bracket depth
>=20
> State-Changed-From-To: closed->feedback
> State-Changed-By: maya@NetBSD.org
> State-Changed-When: Sun, 15 Apr 2018 21:51:55 +0000
> State-Changed-Why:
> please retest with https://netbsd.org/~maya/genattrtab
>=20
Just tried that patch (adjusted for the current Makefile.gnuhost) and it =
addresses the problem.
Thanks!
-- thorpej
From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53178 CVS commit: src/external/gpl3/gcc/dist/gcc
Date: Tue, 17 Apr 2018 10:02:49 +0000
Module Name: src
Committed By: maya
Date: Tue Apr 17 10:02:49 UTC 2018
Modified Files:
src/external/gpl3/gcc/dist/gcc: genattrtab.c
Log Message:
Apply upstream commit:
From: ppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 27 Apr 2016 21:18:05 +0000
Subject: [PATCH] Reduce nesting of parentheses in conditionals generated by
genattrtab
gcc/ChangeLog:
* genattrtab.c (write_test_expr): New parameter EMIT_PARENS
which defaults to true. Emit an outer pair of parentheses only if
EMIT_PARENS. When continuing a chain of && or || (or & or |),
don't emit parentheses for the right-hand operand.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235536
gcc/arm generates so many parens it hits a bracket depth limited which is
enforced by clang. This reduces the number of parens generated and avoids the
need to increase bracket depth.
Fixes PR toolchain/53178 properly.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 src/external/gpl3/gcc/dist/gcc/genattrtab.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: toolchain-manager->maya
Responsible-Changed-By: maya@NetBSD.org
Responsible-Changed-When: Tue, 17 Apr 2018 10:17:25 +0000
Responsible-Changed-Why:
Mine.
State-Changed-From-To: feedback->needs-pullups
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 17 Apr 2018 10:17:25 +0000
State-Changed-Why:
I'd like to pull this up after a martin current test run.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53178 CVS commit: [netbsd-8] src
Date: Wed, 18 Apr 2018 14:01:16 +0000
Module Name: src
Committed By: martin
Date: Wed Apr 18 14:01:16 UTC 2018
Modified Files:
src/external/gpl3/gcc/dist/gcc [netbsd-8]: genattrtab.c
src/tools [netbsd-8]: Makefile.gnuhost
Log Message:
Pull up following revision(s) (requested by maya in ticket #775):
tools/Makefile.gnuhost: revision 1.46-1.48
external/gpl3/gcc/dist/gcc/genattrtab.c: revision 1.2
do the bracket nesting only for clang for now.
Use the __clang__ preprocessor symbol to check for clang, since --version
might barf. From joerg@
Apply upstream commit:
From: ppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 27 Apr 2016 21:18:05 +0000
Subject: [PATCH] Reduce nesting of parentheses in conditionals generated by
genattrtab
gcc/ChangeLog:
* genattrtab.c (write_test_expr): New parameter EMIT_PARENS
which defaults to true. Emit an outer pair of parentheses only if
EMIT_PARENS. When continuing a chain of && or || (or & or |),
don't emit parentheses for the right-hand operand.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235536
gcc/arm generates so many parens it hits a bracket depth limited which is
enforced by clang. This reduces the number of parens generated and avoids the
need to increase bracket depth.
Fixes PR toolchain/53178 properly.
Remove hack previously needed to build gcc/arm with clang.
genattrtab.c:1.2 makes this unnecessary.
Tested by thorpej.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.8.1 \
src/external/gpl3/gcc/dist/gcc/genattrtab.c
cvs rdiff -u -r1.44.8.1 -r1.44.8.2 src/tools/Makefile.gnuhost
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: needs-pullups->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 18 Apr 2018 14:06:36 +0000
State-Changed-Why:
Pulled up. thanks for the patch.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.