Bug 239813 - fix build of lang/gcc9 with clang on powerpc64
Summary: fix build of lang/gcc9 with clang on powerpc64
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Mark Linimon
URL:
Keywords:
: 240076 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-08-13 09:42 UTC by Mark Linimon
Modified: 2019-08-24 17:31 UTC (History)
2 users (show)

See Also:
gerald: maintainer-feedback-


Attachments
patches to lang/gcc9 (7.17 KB, patch)
2019-08-13 09:42 UTC, Mark Linimon
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 2019-08-13 09:42:59 UTC
Created attachment 206484 [details]
patches to lang/gcc9

This patch (as of yet untested) brings the changes from PR 239266 and http://mikael.urankar.free.fr/FreeBSD/powerpc64/lang_gcc8_elfv2.diff to lang/gcc9.
Comment 1 Gerald Pfeifer freebsd_committer 2019-08-13 12:38:03 UTC
I've bit my tongue a couple of times in the last hour and will therefore
not as blunt as I would have been back then.  Still...

 1. I really, really, really would appreciate a bit, just a bit, of
collaboration with upstream here.  The last time I properly reported
a powerpc64 specific issue on FreeBSD with upstream GCC it got fixed
and backported to all relevant release branches within 24 hours.

 2. FreeBSD has an upstream maintainer in GCC, so there should be zero
reason patching files named *freebsd* locally.

 3. I do appreciate getting bug reports that include fixes, but what I
have seen on the powerpc* front as of lately looked a bit random.  With
the proposed patchset here, for example (a) two of the patches are 
tackling the very same issue, (b) patch-gcc_config_rs6000_freebsd64.h	
does something completely different than its description, and (c)
disabling BOOTSTRAP is incorrect pretty much by definition.

 4. Instead of opening new issues, it would be nice to get feedback
on existing ones, e.g. PR 239266 (which relates to item (a) above).
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2019-08-13 23:20:50 UTC
I'll keep this as a local patchset on ppcdevref for now.

I generated this patchset so that I could make progress on the "powerpc64 now defaults to clang" task -- so that we can minimize the regressions that users will experience during the imminent Flag Day.

That task is taking all of my time right now.  Given the many hundreds of changes I have been generating and/or testing, I do not have the cycles to work with every upstream -- the task would never complete, as new ports are added, and, in particular, upgrades to both llvm and gcc happen underneath me.

So, I have not taken the time to investigate the Perfect Way to handle this issue.  I merely modified an existing patchset that allowed me to proceed on testing gcc8-dependent ports, over to gcc9, so that I could proceed on testing the thousands of gcc9-based ports.
Comment 3 Gerald Pfeifer freebsd_committer 2019-08-24 11:27:48 UTC
(In reply to Mark Linimon from comment #2)
> That task is taking all of my time right now.  Given the many hundreds
> of changes I have been generating and/or testing, I do not have the
> cycles to work with every upstream

Yes, but there are also others interested in powerpc and working with
upstream on the toolchain side just is the right thing.

And I helped, but have not been getting feedback from anyone (until I
pushed again) when proposing a patch to work around one of the clang
issues.

Anyway, lang/gcc8 and lang/gcc9 now carry my patch which Mark Millard
kindly verified -- lang/gcc9/files/patch-clang-vec_step.

That should obsolete most of the patchset in this PR (most of which was
not necessary anyway). In particular gcc/tree-vect-loop.c should not see
*any* further changes.

Disabling the BOOTSTRAP option still looks very wrong, and does not seem
to be required by other powerpc users.
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2019-08-24 11:50:30 UTC
I am currently going through the process of rebuilding gcc8 and gcc9, with the patches I had been given and also the latest committed patches, on both of the systems that I have been given access to (both gcc-based and clang-based), and
*very carefully* writing down which result I got from which.

Each run takes the better part of a day.

When that is *complete* I will provide it.

I was not the person that filed the initial report on gcc8, so you will have to take it up with that person.  I thought by porting over that patch that I *might* help other users with gcc9.  Clearly this was not the case and I apologize.

I do have proof that gcc9 does not build on powerpc64 with clang in base but until I can annotate *specifically* the error messages and the patches involved I am going to wait to post it.
Comment 5 Piotr Kubaj freebsd_committer 2019-08-24 17:28:08 UTC
*** Bug 240076 has been marked as a duplicate of this bug. ***
Comment 6 Piotr Kubaj freebsd_committer 2019-08-24 17:31:49 UTC
With today's patches committed, we only need for gcc8:
Index: Makefile
===================================================================
--- Makefile    (revision 509727)
+++ Makefile    (working copy)
@@ -62,7 +62,11 @@

 .elif ${ARCH} == powerpc64
 CONFIGURE_ENV+=        UNAME_m="powerpc64"
+.if ${CHOSEN_COMPILER_TYPE} == gcc
 MAKE_ARGS+=    CFLAGS_FOR_TARGET="-O1" CXXFLAGS_FOR_TARGET="-O1" BOOT_CFLAGS="-O1" # PR235975
+.else
+CONFIGURE_ARGS+=       --with-abi=elfv2
+.endif

 .elif ${ARCH} == powerpcspe
 CONFIGURE_ARGS+=       --with-cpu=8548 --enable-e500_double --without-fp

And for gcc9:
Index: Makefile
===================================================================
--- Makefile    (revision 509727)
+++ Makefile    (working copy)
@@ -61,7 +61,11 @@

 .elif ${ARCH} == powerpc64
 CONFIGURE_ENV+=        UNAME_m="powerpc64"
+.  if ${CHOSEN_COMPILER_TYPE} == gcc
 USE_GCC=       8
+.  else
+CONFIGURE_ARGS+=       --with-abi=elfv2
+.  endif
 .endif

 LANGUAGES:=    c,c++,objc,fortran