diff options
author | marino <marino@pkgsrc.org> | 2012-07-14 21:53:05 +0000 |
---|---|---|
committer | marino <marino@pkgsrc.org> | 2012-07-14 21:53:05 +0000 |
commit | 585e77178dc419e6fcdef45fa43a9b8acead0267 (patch) | |
tree | 8f7ff53d213ee982aad3c8ea44d4185de8af5489 /lang/gcc-aux | |
parent | 2cd7318dbf2054c2f5b5935e1451891bad24f8e1 (diff) | |
download | pkgsrc-585e77178dc419e6fcdef45fa43a9b8acead0267.tar.gz |
lang/gcc-aux: Fix c/c++ precision on FreeBSD/DragonFly
Until now, GCC builders had to choose between Ada and C/C++ on the
following platforms:
i386-FreeBSD
i386-DragonFly
On these platforms, depending on the value of the configuration macro
TARGET_96_ROUND_53_LONG_DOUBLE, either Ada precision or C/C++ long
double precision was broken. The reason is that the floating point unit
of these platforms round off real-time calculations to 53-bit mantissas.
GCC will adjust accordingly to compensate. Since a common backend is used
for all languages, one had to choice which language they wanted correct.
The solution is to break out the object file responsible for this from
the common backend library. Ada now receives an altered version of
insn-modes.o, one that instructs the FPU not to round off the results.
This is all handled by patched Makefiles.
Other changes:
- Configure DragonFly to add ".note.GNU-stack" section to assembly files
to determine if program needs executable stacks
- Skip 2 subtests of Wconversion-real on i386 FreeBSD and DragonFly.
Due to the rounding behavior mentioned above, they fail to produce
error messages as expected. It's not possible to set target with
xfail, and every target && target seems not work work. So we will
assume all gcc-aux platform targets are long-double capabile and
just set xfail for x86 FreeBSD and DragonFly.
- Rework Fortran large real test 2 to skip on x86_64 *BSD. This test
should pass on x86 machines.
- Rework Fortran large real test 3 to be skipped when compiles with -O0
only x86_64 machines. All other combinations will pass.
- Rename C format test typedef from quad_t to quad2_t. DragonFly
has a standard type called quad_t and the type conflict causes a
large number of gcc tests to fail.
- Add dummy dg-error line to avoid an assembly comparison tests on
large files not built (test was marked as UNSUPPORTED but dejagnu is
too dumb to know not to check for the tests' products.)
- Reorder path passed during build when using an already-built gcc-aux
compiler to build new compiler. If gnat-aux is also installed, it
would use the gnat* tools from that compiler rather than gcc-aux
which results in build failure (different versions of tools are
getting used together resulting in build failure).
Diffstat (limited to 'lang/gcc-aux')
-rw-r--r-- | lang/gcc-aux/Makefile | 5 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-ada | 11 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-core | 98 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-cxx-testsuite | 26 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-fortran-testsuite | 4 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-gcc-testsuite | 38 |
6 files changed, 152 insertions, 30 deletions
diff --git a/lang/gcc-aux/Makefile b/lang/gcc-aux/Makefile index c06d744abed..ae494ff31c8 100644 --- a/lang/gcc-aux/Makefile +++ b/lang/gcc-aux/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.1 2012/07/08 19:30:38 marino Exp $ +# $NetBSD: Makefile,v 1.2 2012/07/14 21:53:05 marino Exp $ # PKGNAME= gcc-aux-${SNAPSHOT} DISTNAME= gcc-${GCC_VERSION} +PKGREVISION= 1 CATEGORIES= lang MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/} DISTFILES= ${DISTNAME}.tar.bz2 @@ -44,7 +45,7 @@ BOOTSTRAP_COMPILER= NOT_REQUIRED INTENDED_COMPILER= NATIVE BOOTSTRAP_TRIPLET= NOT SET FULL_GNATGCC= NOT SET -FULL_PATH= /sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin:${PREFIX}/gcc-aux/bin +FULL_PATH= /sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/gcc-aux/bin:${PREFIX}/sbin:${PREFIX}/bin OLD_EH= register_frame REBUILD_LIB= Rebuild the following library first: STICONV= ${PREFIX}/lib/libiconv.a diff --git a/lang/gcc-aux/files/diff-ada b/lang/gcc-aux/files/diff-ada index c17a55e7cdf..cc2bdea0ca8 100644 --- a/lang/gcc-aux/files/diff-ada +++ b/lang/gcc-aux/files/diff-ada @@ -9355,3 +9355,14 @@ mips-sgi-irix*) TOOLS_TARGET_PAIRS="mlib-tgt-specific.adb<mlib-tgt-specific-irix.adb" ;; +--- gcc/ada/gcc-interface/Make-lang.in.orig ++++ gcc/ada/gcc-interface/Make-lang.in +@@ -541,7 +541,7 @@ + ada/widechar.o + + # Language-independent object files. +-ADA_BACKEND = $(BACKEND) attribs.o ++ADA_BACKEND = $(BACKEND2) attribs.o + + # List of target dependent sources, overridden below as necessary + TARGET_ADA_SRCS = diff --git a/lang/gcc-aux/files/diff-core b/lang/gcc-aux/files/diff-core index b9a97a809e1..6040d6cb1a0 100644 --- a/lang/gcc-aux/files/diff-core +++ b/lang/gcc-aux/files/diff-core @@ -462,9 +462,10 @@ +#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") --- /dev/null +++ gcc/config/i386/dragonfly.h -@@ -0,0 +1,101 @@ +@@ -0,0 +1,105 @@ +/* Definitions for Intel 386 running DragonFly with ELF format -+ Copyright (C) 1996, 2000, 2002, 2004, 2007 Free Software Foundation, Inc. ++ Copyright (C) 1996, 2000, 2002, 2004, 2007, 2010, 2011 ++ Free Software Foundation, Inc. + Contributed by Eric Youngdale. + Modified for stabs-in-ELF by H.J. Lu. + Adapted from GNU/Linux version by John Polstra. @@ -548,10 +549,10 @@ +#undef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 0 + -+/* DragonFly sets the rounding precision of the FPU to 53 bits, but GNAT -+ resets it to full precision. */ ++/* DragonFly sets the rounding precision of the FPU to 53 bits. Let the ++ compiler get the contents of <float.h> and std::numeric_limits correct. */ +#undef TARGET_96_ROUND_53_LONG_DOUBLE -+#define TARGET_96_ROUND_53_LONG_DOUBLE 0 ++#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) + +/* Put all *tf routines in libgcc. */ +#undef LIBGCC2_HAS_TF_MODE @@ -564,23 +565,12 @@ + +/* Support for i386 has been removed from DragonFly for several releases */ +#define SUBTARGET32_DEFAULT_CPU "i486" ++ ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ --- gcc/config/i386/freebsd.h.orig +++ gcc/config/i386/freebsd.h -@@ -127,10 +127,10 @@ - #undef DEFAULT_PCC_STRUCT_RETURN - #define DEFAULT_PCC_STRUCT_RETURN 0 - --/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the -- compiler get the contents of <float.h> and std::numeric_limits correct. */ -+/* FreeBSD sets the rounding precision of the FPU to 53 bits, but GNAT -+ resets it to full precision. */ - #undef TARGET_96_ROUND_53_LONG_DOUBLE --#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) -+#define TARGET_96_ROUND_53_LONG_DOUBLE 0 - - /* Put all *tf routines in libgcc. */ - #undef LIBGCC2_HAS_TF_MODE -@@ -148,3 +148,35 @@ +@@ -148,3 +148,34 @@ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack @@ -615,7 +605,6 @@ + (void) mprotect (page, ends - page, perms); \ +} + -+ --- gcc/config/i386/netbsd-elf.h.orig +++ gcc/config/i386/netbsd-elf.h @@ -119,3 +119,9 @@ @@ -1433,7 +1422,66 @@ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then --- gcc/Makefile.in.orig +++ gcc/Makefile.in -@@ -4378,7 +4378,7 @@ +@@ -1150,7 +1150,6 @@ + insn-automata.o \ + insn-emit.o \ + insn-extract.o \ +- insn-modes.o \ + insn-opinit.o \ + insn-output.o \ + insn-peep.o \ +@@ -1469,13 +1468,18 @@ + ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \ + $(OBJS-libcommon-target) @TREEBROWSER@ main.o gccspec.o cppspec.o \ + $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) mips-tfile.o mips-tdump.o \ +- $(GCOV_OBJS) $(GCOV_DUMP_OBJS) ++ $(GCOV_OBJS) $(GCOV_DUMP_OBJS) insn-modes.o insn-modes-ada.o + + # This lists all host object files, whether they are included in this + # compilation or not. + ALL_HOST_OBJS = $(ALL_HOST_FRONTEND_OBJS) $(ALL_HOST_BACKEND_OBJS) + +-BACKEND = main.o @TREEBROWSER@ libbackend.a libcommon-target.a libcommon.a \ ++BACKEND = main.o @TREEBROWSER@ insn-modes.o libbackend.a \ ++ libcommon-target.a libcommon.a \ ++ $(CPPLIB) $(LIBDECNUMBER) ++ ++BACKEND2 = main.o @TREEBROWSER@ insn-modes-ada.o libbackend.a \ ++ libcommon-target.a libcommon.a \ + $(CPPLIB) $(LIBDECNUMBER) + + MOSTLYCLEANFILES = insn-flags.h insn-config.h insn-codes.h \ +@@ -3506,6 +3510,8 @@ + $(TM_H) $(RTL_H) $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H) + insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(MACHMODE_H) ++insn-modes-ada.o : insn-modes-ada.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ++ $(TM_H) $(MACHMODE_H) + insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + $(TM_H) $(RTL_H) $(TM_P_H) insn-config.h $(FLAGS_H) $(RECOG_H) \ + $(EXPR_H) $(OPTABS_H) reload.h +@@ -3599,6 +3605,7 @@ + + insn-modes.c: s-modes; @true + insn-modes.h: s-modes-h; @true ++insn-modes-ada.c: s-modes-ada; @true + min-insn-modes.c: s-modes-m; @true + + s-modes: build/genmodes$(build_exeext) +@@ -3616,6 +3623,12 @@ + $(SHELL) $(srcdir)/../move-if-change tmp-min-modes.c min-insn-modes.c + $(STAMP) s-modes-m + ++s-modes-ada: s-modes ++ $(shell sed -e 's/: TARGET_96_ROUND_53_LONG_DOUBLE \? &ieee_extended_intel_96_round_53_format //' \ ++ < insn-modes.c > tmp-modes-ada.c) ++ $(SHELL) $(srcdir)/../move-if-change tmp-modes-ada.c insn-modes-ada.c ++ $(STAMP) s-modes-ada ++ + insn-preds.c: s-preds; @true + tm-preds.h: s-preds-h; @true + tm-constrs.h: s-constrs-h; @true +@@ -4378,7 +4391,7 @@ DESTDIR=$(@D) \ $(SHELL) $(srcdir)/doc/install.texi2html @@ -1442,7 +1490,7 @@ generated-manpages: man -@@ -4530,7 +4530,7 @@ +@@ -4530,7 +4543,7 @@ # Install the driver last so that the window when things are # broken is small. install: install-common $(INSTALL_HEADERS) \ @@ -1451,7 +1499,7 @@ install-driver install-lto-wrapper install-gcc-ar ifeq ($(enable_plugin),yes) -@@ -4655,6 +4655,9 @@ +@@ -4655,6 +4668,9 @@ -rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext) -( cd $(DESTDIR)$(bindir) && \ $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) ) @@ -1461,7 +1509,7 @@ -if [ -f gcc-cross$(exeext) ] ; then \ if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \ rm -f $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \ -@@ -4728,10 +4731,7 @@ +@@ -4728,10 +4744,7 @@ install-man: lang.install-man \ $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \ $(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \ diff --git a/lang/gcc-aux/files/diff-cxx-testsuite b/lang/gcc-aux/files/diff-cxx-testsuite index f1009504079..fb1ee2a247b 100644 --- a/lang/gcc-aux/files/diff-cxx-testsuite +++ b/lang/gcc-aux/files/diff-cxx-testsuite @@ -1,3 +1,29 @@ +--- gcc/testsuite/c-c++-common/Wconversion-real.c.orig ++++ gcc/testsuite/c-c++-common/Wconversion-real.c +@@ -5,6 +5,12 @@ + /* { dg-options "-std=c99 -Wconversion" { target c } } */ + /* { dg-options "-Wconversion" { target c++ } } */ + /* { dg-require-effective-target large_double } */ ++/* Due to i386 rounding of long doubles on FreeBSD and DragonFly, the tests ++ should be set to "xfail" for those platforms, but it's not possible to ++ set both "target" and "xfail" together. An attempt to mark it ++ UNSUPPORTED for large_long_double and not (i386 FreeBSD i386 DragonFly) ++ failed. All the supported platforms of gcc-aux have large long double ++ so we'll just assume it for these two tests and use xfail instead. */ + + float vfloat; + double vdouble; +@@ -24,8 +30,8 @@ + vfloat = 3.1; /* { dg-warning "conversion" } */ + ffloat (3.1L); /* { dg-warning "conversion" } */ + vfloat = 3.1L; /* { dg-warning "conversion" } */ +- fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */ +- vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */ ++ fdouble (3.1L); /* { dg-warning "conversion" "" { xfail { i?86-*-freebsd* i?86-*-dragonfly* } } } */ ++ vdouble = 3.1L; /* { dg-warning "conversion" "" { xfail { i?86-*-freebsd* i?86-*-dragonfly* } } } */ + ffloat (vdouble); /* { dg-warning "conversion" } */ + vfloat = vdouble; /* { dg-warning "conversion" } */ + ffloat (vlongdouble); /* { dg-warning "conversion" } */ --- gcc/testsuite/g++.dg/cdce3.C.orig +++ gcc/testsuite/g++.dg/cdce3.C @@ -1,4 +1,4 @@ diff --git a/lang/gcc-aux/files/diff-fortran-testsuite b/lang/gcc-aux/files/diff-fortran-testsuite index af58f3abe20..789a9a2d468 100644 --- a/lang/gcc-aux/files/diff-fortran-testsuite +++ b/lang/gcc-aux/files/diff-fortran-testsuite @@ -4,7 +4,7 @@ ! { dg-do run } ! { dg-require-effective-target fortran_large_real } -! { dg-xfail-if "" { "*-*-freebsd*" } { "*" } { "" } } -+! { dg-xfail-if "" { "*-*-freebsd*" *-*-dragonfly* *-*-netbsd* } { "*" } { "" } } ++! { dg-skip-if "Requires cpowl,coshl,sinhl,tanhl,acoshl,asinhl,atanhl,expl,logl,ccosl,csinl,cexpl,clogl" { "x86_64-*-freebsd* x86_64-*-dragonfly* x86_64-*-netbsd*" } { "*" } { "" } } ! Testing library calls on large real kinds (larger than kind=8) implicit none @@ -14,7 +14,7 @@ ! { dg-do run } ! { dg-require-effective-target fortran_large_real } -! { dg-xfail-if "" { "*-*-freebsd*" } { "*" } { "" } } -+! { dg-xfail-if "" { "*-*-freebsd*" *-*-dragonfly* *-*-netbsd* } { "*" } { "" } } ++! { dg-skip-if "Requires erfl,erfcl with -O0" { "x86_64-*-freebsd* x86_64-*-dragonfly* x86_64-*-netbsd*" } { "-O0" } { "" } } ! Testing erf and erfc library calls on large real kinds (larger than kind=8) implicit none diff --git a/lang/gcc-aux/files/diff-gcc-testsuite b/lang/gcc-aux/files/diff-gcc-testsuite index f371a02cd1c..f313ca030d1 100644 --- a/lang/gcc-aux/files/diff-gcc-testsuite +++ b/lang/gcc-aux/files/diff-gcc-testsuite @@ -1,10 +1,46 @@ --- gcc/testsuite/gcc.dg/pch/pch.exp.orig +++ gcc/testsuite/gcc.dg/pch/pch.exp -@@ -44,6 +44,7 @@ +@@ -44,6 +44,8 @@ set test "largefile.c" set testh "largefile.hs" set f [open $test w] +puts $f "/* { dg-do run { target *-*-solaris* } } */" ++puts $f "/* { dg-error \"dummy\" \"fool dejagnu\" { target { ! *-*-solaris* } 20 } } */" puts $f "/* { dg-timeout-factor 4.0 } */" set v 0 for { set v 0 } { $v < 10000 } { incr v } { +--- gcc/testsuite/gcc.dg/format/ext-1.c.orig ++++ gcc/testsuite/gcc.dg/format/ext-1.c +@@ -8,7 +8,7 @@ + #include "format.h" + + void +-foo (quad_t q, u_quad_t uq, quad_t *qn, size_t z, size_t *zn, long long int ll, ++foo (quad2_t q, u_quad2_t uq, quad2_t *qn, size_t z, size_t *zn, long long int ll, + unsigned long long int ull, int i, unsigned int u, double d, + char *s, void *p, wchar_t *ls, wint_t lc, int *n, long int l) + { +--- gcc/testsuite/gcc.dg/format/ext-2.c.orig ++++ gcc/testsuite/gcc.dg/format/ext-2.c +@@ -8,7 +8,7 @@ + #include "format.h" + + void +-foo (quad_t *qp, u_quad_t *uqp, quad_t *qn, long long int *llp, ++foo (quad2_t *qp, u_quad2_t *uqp, quad2_t *qn, long long int *llp, + unsigned long long int *ullp, float *fp, char *s, void **pp, wchar_t *ls, + int *ip, unsigned int *up) + { +--- gcc/testsuite/gcc.dg/format/format.h.orig ++++ gcc/testsuite/gcc.dg/format/format.h +@@ -71,8 +71,8 @@ + #endif + + /* %q formats want a "quad"; GCC considers this to be a long long. */ +-typedef llong quad_t; +-typedef ullong u_quad_t; ++typedef llong quad2_t; ++typedef ullong u_quad2_t; + + __extension__ typedef __INTMAX_TYPE__ intmax_t; + __extension__ typedef __UINTMAX_TYPE__ uintmax_t; |