Bug 221905 - [patch] adapt lang/gcc* to new 'armv7' architecture
Summary: [patch] adapt lang/gcc* to new 'armv7' architecture
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Gerald Pfeifer
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-08-29 12:41 UTC by Mark Linimon
Modified: 2017-10-17 16:52 UTC (History)
3 users (show)

See Also:


Attachments
patch to various files in lang/gcc* (13.05 KB, patch)
2017-08-29 12:41 UTC, Mark Linimon
no flags Details | Diff
add support for armv7 to lang/gcc6 (2.86 KB, patch)
2017-10-09 10:44 UTC, Michal Meloun
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Linimon freebsd_committer freebsd_triage 2017-08-29 12:41:50 UTC
Created attachment 185873 [details]
patch to various files in lang/gcc*

The src tree is splitting 32-bit arm support into 'armv6' and the new 'armv7'.  This patch adds armv7 support.  It should provide no regression on any existing architecture.

I am currently testing this on amd64 for any build regression.

NB: the following obsolete files must be deleted before running:

  lang/gcc48/files/patch-armv6-hf-support
  lang/gcc49/files/patch-armv6-hf-support
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-09-17 07:15:58 UTC
A commit references this bug:

Author: gerald
Date: Sun Sep 17 07:15:28 UTC 2017
New revision: 449987
URL: https://svnweb.freebsd.org/changeset/ports/449987

Log:
  Update to the 201700914 snapshot of GCC 7.2.1.

  Don't quote constant strings compared with ${ARCH}. [1]

  PR:		221905 [1]
  Submitted by:	linimon [1]

Changes:
  head/lang/gcc7-devel/Makefile
  head/lang/gcc7-devel/distinfo
Comment 2 Gerald Pfeifer freebsd_committer freebsd_triage 2017-09-17 07:33:01 UTC
Sorry, I failed to include this PR reference on similar changes I made
to gcc5-devel and gcc6-devel last week, though I did attribute the
origin of the change.

I'm planning to make a similar change to gcc8-devel in the next 24 hours
as today's snapshot is released and am currently testing gcc5 and backports
of the quoting change (and other changes) to gcc49, 48,... as well.
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-09-17 17:51:57 UTC
A commit references this bug:

Author: gerald
Date: Sun Sep 17 17:51:24 UTC 2017
New revision: 450008
URL: https://svnweb.freebsd.org/changeset/ports/450008

Log:
  Do not quote constant strings compared with ${ARCH}. [1]  Remove
  some commented (and thus disabled) logic around this on the way.

  This brings the active lang/gcc* release-based ports in sync with
  their respective lang/gcc*-devel twins.

  PR:		221905 [1]
  Submitted by:	linimon [1]

Changes:
  head/lang/gcc5/Makefile
  head/lang/gcc6/Makefile
  head/lang/gcc7/Makefile
Comment 4 Gerald Pfeifer freebsd_committer freebsd_triage 2017-09-17 18:03:05 UTC
Sorry this took a bit longer; partly I was waiting whether you planned
on send an update to the following, partly I've been traveling too much
on business.

> I am currently testing this on amd64 for any build regression.

I assume no news is good news, so the material changes (I took care of
committing the quoting changes) are

  Approved: gerald (maintainer)

for the lang/gcc[5678]{,-devel} ports.


If you prefer me to do the actual commit instead of doing it yourself,
let me know.


Note: I'd rather prefer not to touch lang/gcc4* in that direction; those
ports are legacy, out of maintenance upstream, and efforts have switched
to GCC 5 and later.
Comment 5 Andreas Tobler freebsd_committer freebsd_triage 2017-09-17 20:58:02 UTC
The patch is not complete yet. At least not for the gcc internals, config.gcc needs some love and we need a default target_cpu_name for the armv7 port.
Which one do you want? For armv6 we have arm1176jzf-s.

TARGET_FREEBSD_ARMv6 is unused in recent gcc's since Nov 2016. Have to find out how much is backported. TARGET_FREEBSD_ARMv7 is unused per se. I do not see a reference where it is used.
Comment 6 commit-hook freebsd_committer freebsd_triage 2017-09-17 21:03:36 UTC
A commit references this bug:

Author: gerald
Date: Sun Sep 17 21:03:03 UTC 2017
New revision: 450026
URL: https://svnweb.freebsd.org/changeset/ports/450026

Log:
  Backport a number of changes from lang/gcc5:

   - Move ONLY_FOR_ARCHS into the right position of the Makefile.

   - Omit a comment describing GCC_VERSION and SUFFIX.

   - Do not quote constant strings compared with ${ARCH}. [1]

   - Last, but not least the only functional change (and an important one):
     Remove headers being created by GCC's fixincludes machinery from
     the installation / packaging to avoid breakage when FreeBSD's headers
     are changing afterwards. [2]

  PR:		221905 [1], 222233 [2]
  Submitted by:	linimon [1]

Changes:
  head/lang/gcc49/Makefile
Comment 7 commit-hook freebsd_committer freebsd_triage 2017-09-21 20:24:16 UTC
A commit references this bug:

Author: gerald
Date: Thu Sep 21 20:24:00 UTC 2017
New revision: 450302
URL: https://svnweb.freebsd.org/changeset/ports/450302

Log:
  Update to the 20170917 snapshot of GCC 8.

  On the way remove quotes around constant strings compared with ${ARCH}. [1]

  PR:		221905 [1]
  Submitted by:	linimon [1]

Changes:
  head/lang/gcc8-devel/Makefile
  head/lang/gcc8-devel/distinfo
Comment 8 Gerald Pfeifer freebsd_committer freebsd_triage 2017-09-22 12:31:17 UTC
(In reply to Andreas Tobler from comment #5)
> The patch is not complete yet. At least not for the gcc internals, config.gcc 
> some love and we need a default target_cpu_name for the armv7 port.

Thanks, Andreas.

That indicates that this needs some upstream changes (which Andreas
can approve, Mark) and then lang/gcc8-devel will be the first port
to update, then working the way back to lang/gcc7-devel and lang/gcc7
and (probably at most) lang/gcc6-devel and lang/gcc6?
Comment 9 commit-hook freebsd_committer freebsd_triage 2017-09-22 13:05:34 UTC
A commit references this bug:

Author: gerald
Date: Fri Sep 22 13:05:17 UTC 2017
New revision: 450370
URL: https://svnweb.freebsd.org/changeset/ports/450370

Log:
  Backport a number of changes from lang/gcc5 and lang/gcc49:

   - Move ONLY_FOR_ARCHS into the right position of the Makefile.

   - Omit a comment describing GCC_VERSION and SUFFIX.

   - Do not quote constant strings compared with ${ARCH}. [1]

   - Last, but not least the only functional change (and an important one):
     Remove headers being created by GCC's fixincludes machinery from
     the installation / packaging to avoid breakage when FreeBSD's headers
     are changing afterwards. [2]

  PR:		221905 [1], 222233 [2]
  Submitted by:	linimon [1]

Changes:
  head/lang/gcc48/Makefile
Comment 10 commit-hook freebsd_committer freebsd_triage 2017-09-23 19:23:26 UTC
A commit references this bug:

Author: gerald
Date: Sat Sep 23 19:23:16 UTC 2017
New revision: 450467
URL: https://svnweb.freebsd.org/changeset/ports/450467

Log:
  Backport several cleanups and one real fix from lang/gcc5:

   - Move ONLY_FOR_ARCHS into the right position of the Makefile.

   - Omit a comment describing GCC_VERSION and SUFFIX.

   - Do not quote constant strings compared with ${ARCH}. [1]

   - Last, but not least the only functional change (and an important one
     at that): Remove headers being created by GCC's fixincludes machinery
     from the installation / packaging to avoid breakage when FreeBSD's
     headers are changing afterwards.

   - On the way, add a TIMESTAMP to distinfo.

  PR:		221905 [1]
  Submitted by:	linimon [1]

Changes:
  head/lang/gcc47/Makefile
  head/lang/gcc47/distinfo
Comment 11 Michal Meloun freebsd_committer freebsd_triage 2017-10-09 10:44:37 UTC
Created attachment 187024 [details]
add support for armv7 to lang/gcc6

Finalize patch for gcc6.
I can confirm that gcc6 can be build on real HW and right architecture is selected by default.
Comment 12 Andreas Tobler freebsd_committer freebsd_triage 2017-10-09 19:32:41 UTC
Thanks Michal!

Yesterday I sent the patches upstream. If I hear nothing, I'll commit soon. Then I propose the patches for the ports tree. Your patch seems not quite correct to me. I wouldn't skip the else in freebsd.h. If you do so you always have arm9 as TARGET_CPU. At least my reading.

The gcc-8 and gcc-7 branches are a bit simpler. I built all except gcc5.
And as a bonus, you'll have to rebuild all your ports if you do the transition ;)
Comment 13 Gerald Pfeifer freebsd_committer freebsd_triage 2017-10-09 20:02:59 UTC
Thank you Andreas (and Michal)!

Having seen the upstream patches, any related changes you want to make
to "my"ports are Approved: gerald (maintainer).

As usual, please focus on newer versions and use a separate patch file
so that we can easily remove that wholy when things have landed upstream
(which is going to take less than a week in case of the -devel ports and
can take months in case of the release-based ports).
Comment 14 Andreas Tobler freebsd_committer freebsd_triage 2017-10-09 20:17:50 UTC
Danke Gerald,

regarding ports tree, I'll only focus on gcc7, gcc6 and maybe gcc5 at a later time.
I'll not touch the gcc?-devel since, as you say, they have a lifetime of about a week.
Comment 15 Michal Meloun freebsd_committer freebsd_triage 2017-10-10 05:50:16 UTC
Oups, sure, '#else' must stay at its place, it was removed by accident. Sorry for this.

But allow me another question. 
All gcc* ports are currently built with full bootstrap. While this is OK for native builds, it take too long qemu based builders (beefy8), gcc7 takes more that 70 hours :(. Do you think that we can switch off full bootstrap for qemu based builds?

Thanks
Comment 16 Gerald Pfeifer freebsd_committer freebsd_triage 2017-10-10 16:24:17 UTC
(In reply to Michal Meloun from comment #15)
> All gcc* ports are currently built with full bootstrap. While this is OK for 
> native builds, it take too long qemu based builders (beefy8), gcc7 takes more
> that 70 hours :(. Do you think that we can switch off full bootstrap for qemu
> based builds?

Yes, you can surely do that by changing the options.  BOOTSTRAP is a
default option for most lang/gcc* ports, but intentionally made an option
so that you can do such a change.
Comment 17 commit-hook freebsd_committer freebsd_triage 2017-10-10 19:18:22 UTC
A commit references this bug:

Author: andreast
Date: Tue Oct 10 19:17:19 UTC 2017
New revision: 451718
URL: https://svnweb.freebsd.org/changeset/ports/451718

Log:
  Add support for armv7-*-freebsd*.
  This patch is already upstreamed and can be dropped once a new GCC 6.x is
  released.

  PR:	221905
  Submitted by:	mmel@
  Approved by:	gerald@ (maintainer)

Changes:
  head/lang/gcc6/Makefile
  head/lang/gcc6/files/patch-armv7-support
Comment 18 commit-hook freebsd_committer freebsd_triage 2017-10-10 19:21:26 UTC
A commit references this bug:

Author: andreast
Date: Tue Oct 10 19:20:31 UTC 2017
New revision: 451719
URL: https://svnweb.freebsd.org/changeset/ports/451719

Log:
  Add support for armv7-*-freebsd*.
  This patch is already upstreamed, it can be dropped when a new GCC 7.x is
  available.

  PR:	221905
  Approved by:	gerald@ (maintainer)

Changes:
  head/lang/gcc7/Makefile
  head/lang/gcc7/files/patch-armv7-support
Comment 19 Andreas Tobler freebsd_committer freebsd_triage 2017-10-10 19:36:18 UTC
So, the main release branches are patched. If you need a patch for gcc5 let me know. GCC has closed the gcc5 branch today. There will be no additional releases for gcc5. I can prep a patch for gcc-5.5, but the patch is local (FreeBSD ports tree) only.

Regarding the gcc8/7/6-devel branches, then next snapshot should contain the patch and the only thing one (Gerald?) needs to do is to apply the snippet below. Gerald, is that ok for you?

Index: Makefile
===================================================================
--- Makefile	(revision 451712)
+++ Makefile	(working copy)
@@ -14,7 +14,7 @@
 LICENSE=	GPLv3 GPLv3RLE
 LICENSE_COMB=	multi
 
-ONLY_FOR_ARCHS=	aarch64 amd64 arm armv6 i386 powerpc powerpc64 sparc64
+ONLY_FOR_ARCHS=	aarch64 amd64 arm armv6 armv7 i386 powerpc powerpc64 sparc64
 
 LIB_DEPENDS=	libgmp.so:math/gmp \
 		libmpfr.so:math/mpfr \
@@ -68,7 +68,7 @@
 USE_GCC=	yes
 .endif
 
-.if ${ARCH} == armv6
+.if ${ARCH} == armv6 || ${ARCH} == armv7
 . if ${COMPILER_TYPE} == clang
 .  if empty(PORT_OPTIONS:MBOOTSTRAP)
 MAKE_ARGS+=CXXFLAGS+=-fbracket-depth=512
Comment 20 Mark Linimon freebsd_committer freebsd_triage 2017-10-11 16:17:38 UTC
Assign to gerald as reminder for the last 2 lines to be patched in the -devel ports RSN.

An email discussion between the 3 of us agreed that there was no point in fixing gcc5, since gcc6 is now the default ports compiler.
Comment 21 commit-hook freebsd_committer freebsd_triage 2017-10-12 16:19:46 UTC
A commit references this bug:

Author: gerald
Date: Thu Oct 12 16:19:24 UTC 2017
New revision: 451905
URL: https://svnweb.freebsd.org/changeset/ports/451905

Log:
  Update to the 20171011 snapshot of GCC 6.4.1.

  Enable this on armv7, courtesy of andreast@ pushing support upstream
  in time for this snapshot.

  PR:		221905

Changes:
  head/lang/gcc6-devel/Makefile
  head/lang/gcc6-devel/distinfo
Comment 22 Gerald Pfeifer freebsd_committer freebsd_triage 2017-10-12 16:40:48 UTC
(In reply to Andreas Tobler from comment #19)
> Regarding the gcc8/7/6-devel branches, then next snapshot should contain the
> patch and the only thing one (Gerald?) needs to do is to apply the snippet
> below. Gerald, is that ok for you?

Sure, I'm taking care.  I noticed I failed to commit the last hunk
(which we were talking about on e-mail).  Should that prove to be
necessary still, we can easily add this.
Comment 23 commit-hook freebsd_committer freebsd_triage 2017-10-14 21:04:56 UTC
A commit references this bug:

Author: gerald
Date: Sat Oct 14 21:03:58 UTC 2017
New revision: 452090
URL: https://svnweb.freebsd.org/changeset/ports/452090

Log:
  Update to the 20171012 snapshot of GCC 7.2.1.

  Enable this on armv7 as well, courtesy of andreast@ pushing support
  upstream in time for this snapshot.

  PR:		221905

Changes:
  head/lang/gcc7-devel/Makefile
  head/lang/gcc7-devel/distinfo
Comment 24 commit-hook freebsd_committer freebsd_triage 2017-10-17 15:51:57 UTC
A commit references this bug:

Author: gerald
Date: Tue Oct 17 15:51:08 UTC 2017
New revision: 452283
URL: https://svnweb.freebsd.org/changeset/ports/452283

Log:
  Update to the 20171008 snapshot of GCC 8.

  Enable this on armv7 as well, courtesy of andreast@ pushing support
  upstream. [1]

  PR:		221905 [1]

Changes:
  head/lang/gcc8-devel/Makefile
  head/lang/gcc8-devel/distinfo
Comment 25 Gerald Pfeifer freebsd_committer freebsd_triage 2017-10-17 16:52:54 UTC
I believe we've now covered all relevant GCC ports (GCC 6 and later,
both the main ports and the -devel flavors), so I'm closing this.

Should there be any additional changes necessary (such as extending
the hack around deficiencies in older versions of clang) please advise
and we'll handle those.