Reviving this with an updated patch...

On 11/29/18 12:19 PM, Brian Callahan wrote:


On 11/29/18 8:17 AM, Pascal Stumpf wrote:
On Wed, 28 Nov 2018 12:47:21 -0500, Brian Callahan wrote:

On 11/28/18 6:54 AM, Stuart Henderson wrote:
On 2018/11/27 19:36, George Koehler wrote:
On Tue, 27 Nov 2018 16:12:08 -0500
George Koehler <kern...@gmail.com> wrote:

NetBSD's packages of gcc5 and gcc7 do contain the headers from float.h
to stdatomic.h (or most of them).  I haven't found the reason why
NetBSD keeps those headers and OpenBSD doesn't.
Found it!

$ cat gcc-6.4.0/gcc/config/t-openbsd
# We don't need GCC's own include files.
USER_H = $(EXTRA_HEADERS)

This t-openbsd gets enabled by gcc-6.4.0/gcc/config.gcc and then
included by build-powerpc/{prev-gcc,gcc}/Makefile so it overrides
USER_H.  The effect is to remove gcc's float.h, iso646.h, stdarg.h,
stdbool.h, stddef.h, varargs.h, stdfix.h, stdnoreturn.h, stdalign.h,
stdatomic.h from the compiler.

The obvious fix (though I haven't tried it) is to remove this USER_H
override, either by commenting it or by patching config.gcc to ignore
t-openbsd.  Most platforms don't override USER_H.  (The only other
platform to override USER_H is config/mips/t-sdemtk, but its
override looks outdated to me.)
This fix seems like the right approach in general to me, I think this
is definitely worth trying.
This causes the build to fail rather quickly. Log attached.
I took the route of commenting out the USER_H line from t-openbsd.

Another option is to keep the USER_H override and add only the 4
headers stdfix.h, stdnoreturn.h, stdalign.h, stdatomic.h. This may
become outdated if a future version of gcc adds more headers.
That sounds like it's asking for future trouble.
This allows the build to succeed, and seems to uncover some issues with
our port (like, we have been enabling SSP in configure but not actually
building or at least installing it?).
We really don't want to install GCC's own libssp and ssp headers.  I
have no idea why adding stuff to USER_H would suddenly enable these, but
can you try to add --disable-libssp to CONFIGURE_ARGS?

Make sense. Yup, added that flag. Simpler diff overall that way. Attached.

~Brian

Diff attached to do add just those headers that are not in /usr/include
and the resulting PLIST changes. Yes it is more work keeping an eye out
to sync this list every time we update gcc, so it may be worth it to fix
the build with all headers enabled if we can.

~Brian

Another option is to add the 4 headers to base OpenBSD.  If there
is some reason why /usr/include has its own float.h, iso646.h, and so
on, then the same reason might be why to add the 4 headers.
I'm not sure if it's the same for all of these headers, but stdatomic.h
in particular seems much more tightly bound to the compiler than to
the OS.

gcc also has its own stdint.h, but doesn't use it on OpenBSD, because
config.gcc defaults to use_gcc_stdint=none and has no code to enable
it on OpenBSD.

For comparison, ports-clang (pkg_info -L llvm) seems to package its
own float.h, iso646.h, and so on, and its own stdint.h; while
base-clang seems to omit headers that exist in /usr/include.
It does for some but not others. diff -wu of iso646.h, for example,
differs only in whitespace, copyright/PD notice, and double-inclusion
protection macro..


application/gzip attachment, name=gcc6.log.gz
text/x-patch content


New diff is mostly the same, except it adds openbsd-stdint.h to the tm_file lines in gcc/config.gcc to all archs that were missing it. This allows the stdatomic.h header to be usable on all archs. Problem reported and fix from George Koehler, who couldn't use stdatomic.h on his macppc and now can.

~Brian

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/gcc/6/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- Makefile	7 Dec 2018 18:27:35 -0000	1.14
+++ Makefile	12 Dec 2018 20:02:47 -0000
@@ -6,7 +6,7 @@ ONLY_FOR_ARCHS = ${GCC49_ARCHS}
 DPB_PROPERTIES = parallel
 
 V = 6.4.0
-REVISION = 3
+REVISION = 4
 FULL_VERSION = $V
 FULL_PKGVERSION = $V
 
@@ -138,6 +138,7 @@ CONFIGURE_ARGS += \
 	--with-system-zlib \
 	--disable-libmudflap \
 	--disable-libgomp \
+	--disable-libssp \
 	--disable-tls \
 	--with-gnu-ld \
 	--with-gnu-as \
Index: patches/patch-gcc_config_gcc
===================================================================
RCS file: /cvs/ports/lang/gcc/6/patches/patch-gcc_config_gcc,v
retrieving revision 1.5
diff -u -p -r1.5 patch-gcc_config_gcc
--- patches/patch-gcc_config_gcc	1 Nov 2018 22:09:30 -0000	1.5
+++ patches/patch-gcc_config_gcc	12 Dec 2018 20:02:47 -0000
@@ -32,7 +32,7 @@ Index: gcc/config.gcc
  	;;
 +arm-*-openbsd*)
 +	tm_defines="${tm_defines} DEFAULT_FLAG_PIE=1"
-+	tm_file="dbxelf.h elfos.h arm/elf.h arm/aout.h arm/openbsd1.h arm/arm.h openbsd.h openbsd-libpthread.h arm/openbsd.h"
++	tm_file="dbxelf.h elfos.h arm/elf.h arm/aout.h arm/openbsd1.h arm/arm.h openbsd.h openbsd-stdint.h openbsd-libpthread.h arm/openbsd.h"
 +	extra_options="${extra_options} openbsd.opt"
 +	tmake_file="${tmake_file} arm/t-arm arm/t-bpabi"
 +	set
@@ -70,13 +70,13 @@ Index: gcc/config.gcc
          ;;
 +mips64-*-openbsd*)
 +       set
-+       tm_file="dbxelf.h elfos.h openbsd.h mips/mips.h mips/openbsd.h openbsd-libpthread.h"
++       tm_file="dbxelf.h elfos.h openbsd.h openbsd-stdint.h mips/mips.h mips/openbsd.h openbsd-libpthread.h"
 +       tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_64 DEFAULT_FLAG_PIE=1"
 +       extra_options="${extra_options} openbsd.opt"
 +       ;;
 +mips64el-*-openbsd*)
 +       set
-+       tm_file="dbxelf.h elfos.h openbsd.h mips/mips.h mips/openbsd.h openbsd-libpthread.h"
++       tm_file="dbxelf.h elfos.h openbsd.h openbsd-stdint.h mips/mips.h mips/openbsd.h openbsd-libpthread.h"
 +       tm_defines="MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_64 TARGET_ENDIAN_DEFAULT=0 DEFAULT_FLAG_PIE=1"
 +       extra_options="${extra_options} openbsd.opt"
 +       ;;
@@ -89,7 +89,7 @@ Index: gcc/config.gcc
  #	;;
 +powerpc-*-openbsd*)
 +	tm_defines="${tm_defines} DEFAULT_FLAG_PIE=2"
-+	tm_file="rs6000/secureplt.h ${tm_file} dbxelf.h elfos.h openbsd.h openbsd-libpthread.h freebsd-spec.h rs6000/sysv4.h rs6000/openbsd.h"
++	tm_file="rs6000/secureplt.h ${tm_file} dbxelf.h elfos.h openbsd.h openbsd-stdint.h openbsd-libpthread.h freebsd-spec.h rs6000/sysv4.h rs6000/openbsd.h"
 +	tmake_file="${tmake_file} rs6000/t-openbsd"
 +	extra_options="${extra_options} rs6000/sysv4.opt openbsd.opt"
 +	;;
Index: patches/patch-gcc_config_t-openbsd
===================================================================
RCS file: patches/patch-gcc_config_t-openbsd
diff -N patches/patch-gcc_config_t-openbsd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-gcc_config_t-openbsd	12 Dec 2018 20:02:47 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Make sure to include standard headers that are tightly bound
+to the compiler, such as stdatomic.h
+
+Index: gcc/config/t-openbsd
+--- gcc/config/t-openbsd.orig
++++ gcc/config/t-openbsd
+@@ -1,2 +1,6 @@
+ # We don't need GCC's own include files.
+-USER_H = $(EXTRA_HEADERS)
++USER_H = $(srcdir)/ginclude/stdfix.h \
++	 $(srcdir)/ginclude/stdnoreturn.h \
++	 $(srcdir)/ginclude/stdalign.h \
++	 $(srcdir)/ginclude/stdatomic.h \
++	 $(EXTRA_HEADERS)
Index: pkg/PLIST-c++
===================================================================
RCS file: /cvs/ports/lang/gcc/6/pkg/PLIST-c++,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 PLIST-c++
--- pkg/PLIST-c++	4 Sep 2016 16:20:22 -0000	1.1.1.1
+++ pkg/PLIST-c++	12 Dec 2018 20:02:47 -0000
@@ -219,6 +219,7 @@ include/c++/${V}/experimental/bits/fs_di
 include/c++/${V}/experimental/bits/fs_fwd.h
 include/c++/${V}/experimental/bits/fs_ops.h
 include/c++/${V}/experimental/bits/fs_path.h
+include/c++/${V}/experimental/bits/lfts_config.h
 include/c++/${V}/experimental/bits/shared_ptr.h
 include/c++/${V}/experimental/bits/string_view.tcc
 include/c++/${V}/experimental/chrono
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/lang/gcc/6/pkg/PLIST-main,v
retrieving revision 1.7
diff -u -p -r1.7 PLIST-main
--- pkg/PLIST-main	1 Nov 2018 22:09:30 -0000	1.7
+++ pkg/PLIST-main	12 Dec 2018 20:02:47 -0000
@@ -6,6 +6,7 @@
 @bin bin/egcc-nm
 @bin bin/egcc-ranlib
 @bin bin/egcov
+@bin bin/egcov-dump
 @bin bin/egcov-tool
 @bin bin/${CONFIG}-egcc
 @bin bin/${CONFIG}-egcc-ar
@@ -20,10 +21,15 @@
 lib/gcc/
 lib/gcc/${CONFIG}/
 lib/gcc/${CONFIG}/${V}/
+lib/gcc/${CONFIG}/${V}/include/
 lib/gcc/${CONFIG}/${V}/include-fixed/
 lib/gcc/${CONFIG}/${V}/include-fixed/README
 lib/gcc/${CONFIG}/${V}/include-fixed/limits.h
 lib/gcc/${CONFIG}/${V}/include-fixed/syslimits.h
+lib/gcc/${CONFIG}/${V}/include/stdalign.h
+lib/gcc/${CONFIG}/${V}/include/stdatomic.h
+lib/gcc/${CONFIG}/${V}/include/stdfix.h
+lib/gcc/${CONFIG}/${V}/include/stdnoreturn.h
 lib/gcc/${CONFIG}/${V}/install-tools/
 lib/gcc/${CONFIG}/${V}/install-tools/fixinc_list
 lib/gcc/${CONFIG}/${V}/install-tools/gsyslimits.h
@@ -437,6 +443,8 @@ libexec/gcc/${CONFIG}/${V}/plugin/
 @bin libexec/gcc/${CONFIG}/${V}/plugin/gengtype
 @man man/man1/ecpp.1
 @man man/man1/egcc.1
+@man man/man1/egcov-dump.1
+@man man/man1/egcov-tool.1
 @man man/man1/egcov.1
 @man man/man7/fsf-funding.7
 @man man/man7/gfdl.7

Reply via email to