[armv7 fix] Fix build lang/gcc/4.9

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[armv7 fix] Fix build lang/gcc/4.9

Markus Hennecke
Resubmitting this, gcc 4.9 builds with this on armv7. All regression tests
fail though. As already stated I successfuly build gcc on i386 and amd64
with this patch.

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/4.9/Makefile,v
retrieving revision 1.54
diff -u -p -r1.54 Makefile
--- Makefile 15 Mar 2018 01:16:42 -0000 1.54
+++ Makefile 6 Apr 2018 13:13:10 -0000
@@ -4,7 +4,7 @@ ONLY_FOR_ARCHS = ${GCC49_ARCHS}
 DPB_PROPERTIES = parallel
 
 V = 4.9.4
-REVISION = 8
+REVISION = 9
 FULL_VERSION = $V
 FULL_PKGVERSION = $V
 
Index: patches/patch-gcc_configure
===================================================================
RCS file: /cvs/ports/lang/gcc/4.9/patches/patch-gcc_configure,v
retrieving revision 1.5
diff -u -p -r1.5 patch-gcc_configure
--- patches/patch-gcc_configure 1 Sep 2016 17:30:33 -0000 1.5
+++ patches/patch-gcc_configure 6 Apr 2018 13:13:10 -0000
@@ -1,7 +1,20 @@
 $OpenBSD: patch-gcc_configure,v 1.5 2016/09/01 17:30:33 pascal Exp $
---- gcc/configure.orig Sun May 22 10:53:32 2016
-+++ gcc/configure Sat Aug  6 19:19:05 2016
-@@ -17367,7 +17367,7 @@ openbsd*)
+Index: gcc/configure
+--- gcc/configure.orig
++++ gcc/configure
+@@ -6597,6 +6597,11 @@ $as_echo "$ac_res" >&6; }
+ fi
+   done
+ CFLAGS="$save_CFLAGS"
++if [[ `uname -m` == armv7 ]] ; then
++  if $CC --version 2>&1 | grep clang; then
++    noexception_flags="$noexception_flags -fbracket-depth=512"
++  fi
++fi
+
+
+ # Enable expensive internal checks
+@@ -17367,7 +17372,7 @@ openbsd*)
      *) need_version=no  ;;
    esac
    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
@@ -10,7 +23,7 @@ $OpenBSD: patch-gcc_configure,v 1.5 2016
    shlibpath_var=LD_LIBRARY_PATH
    if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
      case $host_os in
-@@ -21027,7 +21027,7 @@ openbsd*)
+@@ -21027,7 +21032,7 @@ openbsd*)
      *) need_version=no  ;;
    esac
    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
@@ -19,7 +32,7 @@ $OpenBSD: patch-gcc_configure,v 1.5 2016
    shlibpath_var=LD_LIBRARY_PATH
    if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
      case $host_os in
-@@ -27522,6 +27522,7 @@ else
+@@ -27522,6 +27527,7 @@ else
  fi
 
          ;;
Index: patches/patch-gcc_system_h
===================================================================
RCS file: patches/patch-gcc_system_h
diff -N patches/patch-gcc_system_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-gcc_system_h 6 Apr 2018 13:13:10 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+
+Index: gcc/system.h
+--- gcc/system.h.orig
++++ gcc/system.h
+@@ -231,6 +231,7 @@ extern int errno;
+    file uses a standard library header that includes <cstdlib>, we will get
+    an error about 'using std::malloc'.  */
+ #ifdef __cplusplus
++#include <new>
+ #include <cstdlib>
+ #endif
+

Reply | Threaded
Open this post in threaded view
|

Re: [armv7 fix] Fix build lang/gcc/4.9

Markus Hennecke
Attached is a new diff fixing build on armv7 and adding patches to fix the
build after the switch to clang 6. The patch became pretty big, because
clang complains about error: invalid suffix on literal; C++11 requires a
space between literal and identifier [-Wreserved-user-defined-literal] in
a lot of files.
No change in the armv7 fixes, still setting -fbracket-depth=512 in case CC
is clang and adding #include <new> in gcc/system.h when compiling c++.


gcc.arm.patch (26K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [armv7 fix] Fix build lang/gcc/4.9

s_graf
In reply to this post by Markus Hennecke
I tried to build gcc with your patch and ran into the error below. I did not see any patches applied to ipa-devirt.c

/usr/ports/pobj/gcc-4.9.4/gcc-4.9.4/gcc/ipa-devirt.c:1637:32: error: invalid suffix on literal; C++11
      requires a space between literal and identifier [-Wreserved-user-defined-literal]
      fprintf (f, " at offset "HOST_WIDE_INT_PRINT_DEC"\n",
                               ^

5 warnings and 1 error generated.
gmake[3]: *** [Makefile:1058: ipa-devirt.o] Error 1
gmake[3]: Leaving directory '/usr/ports/pobj/gcc-4.9.4/build-arm/gcc'
gmake[2]: *** [Makefile:4217: all-stage1-gcc] Error 2
gmake[2]: Leaving directory '/usr/ports/pobj/gcc-4.9.4/build-arm'
gmake[1]: *** [Makefile:17735: stage1-bubble] Error 2
gmake[1]: Leaving directory '/usr/ports/pobj/gcc-4.9.4/build-arm'
gmake: *** [Makefile:17872: bootstrap2] Error 2
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2742 '/usr/ports/pobj/gcc-4.9.4/build-arm/.build_done')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:1938 '/usr/ports/packages/arm/all/gcc-4.9.4p9.tgz')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2440 '_internal-package')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2419 'package')
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:1956 '/var/db/pkg/gcc-4.9.4p9/+CONTENTS')
*** Error 1 in /usr/ports/lang/gcc/4.9 (/usr/ports/infrastructure/mk/bsd.port.mk:2419 'install')

-----Original Message-----
From: [hidden email] <[hidden email]> On Behalf Of Markus Hennecke
Sent: April 15, 2018 9:04 AM
To: [hidden email]
Subject: Re: [armv7 fix] Fix build lang/gcc/4.9

Attached is a new diff fixing build on armv7 and adding patches to fix the build after the switch to clang 6. The patch became pretty big, because clang complains about error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] in a lot of files.
No change in the armv7 fixes, still setting -fbracket-depth=512 in case CC is clang and adding #include <new> in gcc/system.h when compiling c++.


Reply | Threaded
Open this post in threaded view
|

Re: [armv7 fix] Fix build lang/gcc/4.9

Jeremie Courreges-Anglas-2

+cc maintainer

> -----Original Message-----
> From: [hidden email] <[hidden email]> On Behalf Of Markus Hennecke
> Sent: April 15, 2018 9:04 AM
> To: [hidden email]
> Subject: Re: [armv7 fix] Fix build lang/gcc/4.9
>
> Attached is a new diff fixing build on armv7 and adding patches to fix
> the build after the switch to clang 6. The patch became pretty big,
> because clang complains about error: invalid suffix on literal; C++11
> requires a space between literal and identifier
> [-Wreserved-user-defined-literal] in a lot of files.
> No change in the armv7 fixes, still setting -fbracket-depth=512 in case CC is clang and adding #include <new> in gcc/system.h when compiling c++.

On Sun, Apr 15 2018, <[hidden email]> wrote:
> I tried to build gcc with your patch and ran into the error below. I did not see any patches applied to ipa-devirt.c
>
> /usr/ports/pobj/gcc-4.9.4/gcc-4.9.4/gcc/ipa-devirt.c:1637:32: error: invalid suffix on literal; C++11
>       requires a space between literal and identifier [-Wreserved-user-defined-literal]
>       fprintf (f, " at offset "HOST_WIDE_INT_PRINT_DEC"\n",

Correct, I've spotted this also.  I have committed
the -Wreserved-user-defined-literal diffs (including the one for
ipa-devirt.c) since they are trivial and we need a working ports-gcc for
the upcoming hackathon.

I'm testing the -fbracket-depth=512 diff on arm, build still ongoing.


Index: patches/patch-gcc_configure
===================================================================
RCS file: /cvs/ports/lang/gcc/4.9/patches/patch-gcc_configure,v
retrieving revision 1.5
diff -u -p -r1.5 patch-gcc_configure
--- patches/patch-gcc_configure 1 Sep 2016 17:30:33 -0000 1.5
+++ patches/patch-gcc_configure 15 Apr 2018 23:47:01 -0000
@@ -1,7 +1,20 @@
 $OpenBSD: patch-gcc_configure,v 1.5 2016/09/01 17:30:33 pascal Exp $
---- gcc/configure.orig Sun May 22 10:53:32 2016
-+++ gcc/configure Sat Aug  6 19:19:05 2016
-@@ -17367,7 +17367,7 @@ openbsd*)
+Index: gcc/configure
+--- gcc/configure.orig
++++ gcc/configure
+@@ -6597,6 +6597,11 @@ $as_echo "$ac_res" >&6; }
+ fi
+   done
+ CFLAGS="$save_CFLAGS"
++if [[ `uname -m` == armv7 ]] ; then
++  if $CC --version 2>&1 | grep clang; then
++    noexception_flags="$noexception_flags -fbracket-depth=512"
++  fi
++fi
+
+
+ # Enable expensive internal checks
+@@ -17367,7 +17372,7 @@ openbsd*)
      *) need_version=no  ;;
    esac
    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
@@ -10,7 +23,7 @@ $OpenBSD: patch-gcc_configure,v 1.5 2016
    shlibpath_var=LD_LIBRARY_PATH
    if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
      case $host_os in
-@@ -21027,7 +21027,7 @@ openbsd*)
+@@ -21027,7 +21032,7 @@ openbsd*)
      *) need_version=no  ;;
    esac
    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
@@ -19,7 +32,7 @@ $OpenBSD: patch-gcc_configure,v 1.5 2016
    shlibpath_var=LD_LIBRARY_PATH
    if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
      case $host_os in
-@@ -27522,6 +27522,7 @@ else
+@@ -27522,6 +27527,7 @@ else
  fi
 
          ;;


--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply | Threaded
Open this post in threaded view
|

Re: [armv7 fix] Fix build lang/gcc/4.9

Pascal Stumpf-2
In reply to this post by s_graf
On Mon, 16 Apr 2018 23:14:53 +0200, Jeremie Courreges-Anglas wrote:

> On Mon, Apr 16 2018, <[hidden email]> wrote:
> > I tried to continue the build of php with the ports snapshot of today and ran into another gcc problem:
>
> [...]
>
> > /usr/ports/pobj/gcc-4.9.4/gcc-4.9.4/gcc/config/arm/arm.md:97:16: warning: equality comparison with
> >       extraneous parentheses [-Wparentheses-equality]
> > (thumb1_code)) == (
> > ~~~~~~~~~~~~~~~^~~~
> > /usr/ports/pobj/gcc-4.9.4/gcc-4.9.4/gcc/config/arm/arm.md:97:16: note: remove extraneous parentheses
> >       around the comparison to silence this warning
> > (thumb1_code)) == (
> >                ^
> > /usr/ports/pobj/gcc-4.9.4/gcc-4.9.4/gcc/config/arm/arm.md:97:16: note: use '=' to turn this equality
> >       comparison into an assignment
> > (thumb1_code)) == (
> >                ^~
> >                =
> > /usr/ports/pobj/gcc-4.9.4/gcc-4.9.4/gcc/config/arm/neon.md:3486:10917: fatal error: bracket nesting
> >       level exceeded maximum of 256
> > /usr/ports/pobj/gcc-4.9.4/gcc-4.9.4/gcc/config/arm/neon.md:3486:10917: note: use -fbracket-depth=N to
> >       increase maximum nesting level
> > 33 warnings and 1 error generated.
> > gmake[3]: *** [Makefile:1058: insn-attrtab.o] Error 1
>
> Well this seems to be handled by the diff in my previous mail, attached
> again for convenience.  gcc (FLAVOR='no_java no_ada') packages, install,
> and seems to run.  dpb ongoing.
>
> Technically a clang-specific fix but it already happened with clang-5.0.

This may be a better approach; after all, we need the flag for only one
file.  Currently testing on armv7, will have results by tomorrow.

The real fix would be to test for the flag in configure, of course.

Index: patches/patch-gcc_Makefile_in
===================================================================
RCS file: /cvs/ports/lang/gcc/4.9/patches/patch-gcc_Makefile_in,v
retrieving revision 1.1
diff -u -p -r1.1 patch-gcc_Makefile_in
--- patches/patch-gcc_Makefile_in 10 Feb 2015 22:04:54 -0000 1.1
+++ patches/patch-gcc_Makefile_in 17 Apr 2018 14:57:22 -0000
@@ -2,9 +2,23 @@ $OpenBSD: patch-gcc_Makefile_in,v 1.1 20
 
 Disable fixincludes madness
 
---- gcc/Makefile.in.orig Tue Feb  3 17:16:24 2015
-+++ gcc/Makefile.in Tue Feb  3 17:17:57 2015
-@@ -2730,7 +2730,7 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \
+Index: gcc/Makefile.in
+--- gcc/Makefile.in.orig
++++ gcc/Makefile.in
+@@ -1944,6 +1944,12 @@ DRIVER_DEFINES = \
+
+ CFLAGS-gcc.o += $(DRIVER_DEFINES)
+
++ISCLANG = $(shell $CC --version | grep -c clang)
++
++ifeq ($(ISCLANG),1)
++CFLAGS-insn-attrtab.o += -fbracket-depth=512
++endif
++
+ specs.h : s-specs ; @true
+ s-specs : Makefile
+ lsf="$(lang_specs_files)"; for f in $$lsf; do \
+@@ -2730,7 +2736,7 @@ stmp-fixinc: gsyslimits.h macro_list fixinc_list \
       gcc_dir=`${PWD_COMMAND}` ; \
       export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
       cd $(build_objdir)/fixincludes && \