summaryrefslogtreecommitdiff
path: root/lang/gcc-aux
diff options
context:
space:
mode:
authormarino <marino@pkgsrc.org>2014-05-13 08:18:04 +0000
committermarino <marino@pkgsrc.org>2014-05-13 08:18:04 +0000
commitb31f10a9e6e512056b6420e8b0e55ad520d54b3c (patch)
tree40c481efe8fcf5efdaba8ef6ac42db3e5606a3c9 /lang/gcc-aux
parentb9710c9ddea3142357834fb61566087cdc3c8b8d (diff)
downloadpkgsrc-b31f10a9e6e512056b6420e8b0e55ad520d54b3c.tar.gz
lang/gcc-aux: Enable dl_iterate_phdr and link with gold
These changes are for NetBSD only although non-functional OpenBSD support continues to be added. The biggest change is configuring the compiler to use the gold linker from binutils 2.24 instead of the system linker. The ld.bfd linker from binutils 2.24 is buggy on NetBSD and OpenBSD; it cannot properly produce/recognize PIC files in every case, which is why gcc-aux had been limited to the system linker. The system linker was too old for gcc-aux and devel/gps failed to link because of it. At the same time, the dormant dl_iterate_phdr support has been activated for NetBSD. It seems to work; the Ada testsuite still passes perfectly. Due to lack of testing, gold is restricted from building on NetBSD 5, which means lang/gcc-aux will fail to build as a result. If someone verifies gold builds on NetBSD 5, then the restriction on binutils can be removed and lang/gcc-aux will be able to build on NetBSD 5 again.
Diffstat (limited to 'lang/gcc-aux')
-rw-r--r--lang/gcc-aux/Makefile48
-rw-r--r--lang/gcc-aux/files/diff-ada8
-rw-r--r--lang/gcc-aux/files/diff-core114
-rw-r--r--lang/gcc-aux/options.mk25
4 files changed, 160 insertions, 35 deletions
diff --git a/lang/gcc-aux/Makefile b/lang/gcc-aux/Makefile
index 0a86d785c72..e9b3c081374 100644
--- a/lang/gcc-aux/Makefile
+++ b/lang/gcc-aux/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.18 2014/05/09 09:50:47 marino Exp $
+# $NetBSD: Makefile,v 1.19 2014/05/13 08:18:04 marino Exp $
#
PKGNAME= gcc-aux-${SNAPSHOT}
DISTNAME= gcc-${GCC_VERSION}
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
DISTFILES= ${DISTNAME}.tar.bz2
@@ -13,15 +13,15 @@ HOMEPAGE= http://www.dragonlace.net/
COMMENT= GNAT Ada compiler based on GCC ${GCC_BRANCH}
LICENSE= gnu-gpl-v3 AND gnu-lgpl-v3
+LANGS= c ada c++
+USE_TOOLS+= gmake sed:run perl makeinfo bzip2 patch pod2man tar
+APPLY_DIFFS= core ada cxx
+
.include "Makefile.version"
.include "Makefile.testsuite"
.include "../../mk/bsd.prefs.mk"
.include "options.mk"
-LANGS= c ada c++
-USE_TOOLS+= gmake sed:run perl makeinfo bzip2 patch pod2man tar
-APPLY_DIFFS= core ada cxx
-
# Requires bootstrap compiler, which is only available for on selected systems
# Disable SunOS for now until multilib version can be built and tested.
@@ -32,10 +32,8 @@ ONLY_FOR_PLATFORM= DragonFly-*-* \
NetBSD-[5-9]*-x86_64 \
SunOS-5.1[1-9]*-i386 \
SunOS-5.1[1-9]*-x86_64
-# OpenBSD-*-amd64
-# OpenBSD-*-i386
-# MirBSD-*-amd64
-# MirBSD-*-i386
+
+#ONLY_FOR_PLATFORM+= OpenBSD-*-amd64 MirBSD-*-amd64
GARCH= ${MACHINE_ARCH:S/amd64/x86_64/}
BLD_TARGET= ${GARCH}-aux-${LOWER_OPSYS}${OS_VERSION}
@@ -66,6 +64,7 @@ BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.freebsd.100B.tar.bz2
NELF= elf
.endif
XLDF= -lm
+MODERN_BINUTILS= yes
BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.netbsd.614.tar.bz2
BLD_TARGET= ${MACHINE_ARCH}-aux-netbsd${NELF}${NSUFF}
.endif
@@ -85,7 +84,10 @@ NATIVE_LINKER!= which ld
.endif
.if ${OPSYS} == OpenBSD || ${OPSYS} == MirBSD
+OPENMIR= yes
MODERN_BINUTILS= yes
+EXTRA_CONFARGS+= --disable-libstdcxx-pch
+BOOTSTRAP_COMPILER= ada-bootstrap.${GARCH}.openbsd.55.tar.bz2
.endif
.if defined(MODERN_BINUTILS)
@@ -99,8 +101,8 @@ MY_CONFIGURE_ENV+= RANLIB=${PREFIX}/bin/granlib
. if defined(NATIVE_LINKER)
EXTRA_CONFARGS+= --without-gnu-ld --with-ld=${NATIVE_LINKER}
. else
-EXTRA_CONFARGS+= --with-gnu-ld --with-ld=${PREFIX}/bin/gld
-MY_CONFIGURE_ENV+= LD=${PREFIX}/bin/gld
+EXTRA_CONFARGS+= --with-gnu-ld --with-ld=${PREFIX}/bin/gld.gold
+MY_CONFIGURE_ENV+= LD=${PREFIX}/bin/gld.gold
. endif
.else
EXTRA_CONFARGS+= --with-gnu-ld --with-ld=/usr/bin/ld
@@ -112,6 +114,7 @@ EXTRA_CONFARGS+= --with-gnu-as --with-as=/usr/bin/as
WRKSRC= ${WRKDIR}/gcc-${GCC_VERSION}
BUILDDIR= ${WRKDIR}/build
NEWBSDIR= ${WRKDIR}/newbs/bootstrap
+SYSLIBDIR= ${WRKDIR}/lib
CFG_SCRIPT= ${WRKSRC}/configure
REVFILE= ${WRKSRC}/gcc/REVISION
BOOTSTRAP_PREFIX= ${WRKDIR}/bootstrap
@@ -209,12 +212,31 @@ post-extract:
-pe 's|se_NO|no_NO|g;' \
-pe 's|es_MX|es_ES|g;' \
-pe 's|ru_RU.UTF8|ru_RU.UTF-8|g' ${LOCALE22FIX})
-.if !empty(PKG_OPTIONS:Mstatic) || !empty(PKG_OPTIONS:Mbootstrap)
+.if defined(STATIC_BUILD) || !empty(PKG_OPTIONS:Mbootstrap)
. if ${OPSYS} != SunOS
# Ensure GNAT tools are built statically
${PERL5} -pi -e 's/^GCC_LINK_FLAGS=.*/GCC_LINK_FLAGS=-static/' \
${WRKSRC}/gcc/ada/gcc-interface/Makefile.in
. endif
+.else
+. if defined(OPENMIR)
+ # OpenBSD has no system libraries ending in ".so" so the pkgsrc linker
+ # fails to link things like "-lutil -lm". Work around this oddity.
+ ${MKDIR} ${SYSLIBDIR}
+. for sl in c m z util pthread
+ ${LN} -s `ls /usr/lib/lib${sl}.so* | head -1` ${SYSLIBDIR}/lib${sl}.so
+. endfor
+ ${PERL5} -i -pe 's|\$$\(MISCLIB\)|-L${SYSLIBDIR} \$$(MISCLIB)|g;' \
+ -pe 's|\$$\(THREADSLIB\)|-L${SYSLIBDIR} \$$(THREADSLIB)|g' \
+ ${WRKSRC}/gcc/ada/gcc-interface/Makefile.in
+ ${PERL5} -i -pe 's|-lpthread|-L${SYSLIBDIR} -lpthread|g;' \
+ -pe 's|@XCFLAGS@|-L${SYSLIBDIR} @XCFLAGS@|g;' \
+ -pe 's|-lm|-L${SYSLIBDIR} -lm|g' \
+ ${WRKSRC}/libquadmath/Makefile.in \
+ ${WRKSRC}/libgfortran/Makefile.in \
+ ${WRKSRC}/libcilkrts/Makefile.in \
+ ${WRKSRC}/libitm/Makefile.in
+. endif
.endif
.if !exists(${LOCALBASE}/gcc-aux/bin/ada) && ${OPSYS} == SunOS
# In case /usr/pkg/bin/gas doesn't exist, establish fallback
diff --git a/lang/gcc-aux/files/diff-ada b/lang/gcc-aux/files/diff-ada
index 6ee0ad37559..4b22475cd16 100644
--- a/lang/gcc-aux/files/diff-ada
+++ b/lang/gcc-aux/files/diff-ada
@@ -7741,7 +7741,7 @@
+ Always_Compatible_Rep : constant Boolean := False;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
-+ ZCX_By_Default : constant Boolean := True;
++ ZCX_By_Default : constant Boolean := False;
+
+end System;
--- /dev/null
@@ -7888,7 +7888,7 @@
+ Always_Compatible_Rep : constant Boolean := False;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
-+ ZCX_By_Default : constant Boolean := True;
++ ZCX_By_Default : constant Boolean := False;
+
+end System;
--- gcc/ada/terminals.c.orig
@@ -8372,7 +8372,7 @@
+ EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o
+
-+ EH_MECHANISM=-gcc
++ EH_MECHANISM=
+ THREADSLIB= -lpthread
+ GMEM_LIB = gmemlib
+ LIBRARY_VERSION := $(LIB_VERSION)
@@ -8407,7 +8407,7 @@
+ EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
+ EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o
+
-+ EH_MECHANISM=-gcc
++ EH_MECHANISM=
+ THREADSLIB= -lpthread
+ GMEM_LIB = gmemlib
+ LIBRARY_VERSION := $(LIB_VERSION)
diff --git a/lang/gcc-aux/files/diff-core b/lang/gcc-aux/files/diff-core
index e4c7ddf44a4..e3cc3919f64 100644
--- a/lang/gcc-aux/files/diff-core
+++ b/lang/gcc-aux/files/diff-core
@@ -350,10 +350,23 @@
#endif
#undef LIB_SPEC
-@@ -285,5 +285,9 @@
+@@ -143,6 +143,9 @@
+ #define LIB_SPEC OBSD_LIB_SPEC
+ #endif
+
++#undef LINK_PIE_SPEC
++#define LINK_PIE_SPEC "%{pie:-pie} %{p|pg|nopie:-nopie} "
++
+ #define TARGET_POSIX_IO
+
+ /* All new versions of OpenBSD have C99 functions. We redefine this hook
+@@ -285,5 +288,12 @@
/* Storage layout. */
++/* Silence "unsafe GNU crap" messages */
++#define NO_UNSAFE_BUILTINS
++
+/* The system headers on OpenBSD are C++-aware. */
+#undef NO_IMPLICIT_EXTERN_C
+#define NO_IMPLICIT_EXTERN_C
@@ -1325,6 +1338,60 @@
#endif
+#endif
}
+--- gcc/builtins.c.orig
++++ gcc/builtins.c
+@@ -125,9 +125,11 @@
+ static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode);
+ static rtx expand_builtin_mempcpy_args (tree, tree, tree, rtx,
+ enum machine_mode, int);
++#ifndef NO_UNSAFE_BUILTINS
+ static rtx expand_builtin_strcpy (tree, rtx);
+ static rtx expand_builtin_strcpy_args (tree, tree, rtx);
+ static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode);
++#endif
+ static rtx expand_builtin_strncpy (tree, rtx);
+ static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode);
+ static rtx expand_builtin_memset (tree, rtx, enum machine_mode);
+@@ -3370,6 +3372,7 @@
+ # define CODE_FOR_movstr CODE_FOR_nothing
+ #endif
+
++#ifndef NO_UNSAFE_BUILTINS
+ /* Expand into a movstr instruction, if one is available. Return NULL_RTX if
+ we failed, the caller should emit a normal call, otherwise try to
+ get the result in TARGET, if convenient. If ENDP is 0 return the
+@@ -3521,6 +3524,7 @@
+ return expand_movstr (dst, src, target, /*endp=*/2);
+ }
+ }
++#endif
+
+ /* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE)
+ bytes from constant string DATA + OFFSET and return it as target
+@@ -6140,9 +6144,11 @@
+ break;
+
+ case BUILT_IN_STRCPY:
++#ifndef NO_UNSAFE_BUILTINS
+ target = expand_builtin_strcpy (exp, target);
+ if (target)
+ return target;
++#endif
+ break;
+
+ case BUILT_IN_STRNCPY:
+@@ -6152,9 +6158,11 @@
+ break;
+
+ case BUILT_IN_STPCPY:
++#ifndef NO_UNSAFE_BUILTINS
+ target = expand_builtin_stpcpy (exp, target, mode);
+ if (target)
+ return target;
++#endif
+ break;
+
+ case BUILT_IN_MEMCPY:
--- gcc/config.gcc.orig
+++ gcc/config.gcc
@@ -687,6 +687,26 @@
@@ -1394,7 +1461,36 @@
;;
i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h"
-@@ -4109,6 +4140,8 @@
+@@ -1375,6 +1406,7 @@
+ use_collect2=yes
+ ;;
+ i[34567]86-*-openbsd*)
++ tm_defines="${tm_defines} PIE_DEFAULT=1"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
+ tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h"
+ extra_options="${extra_options} openbsd.opt"
+@@ -1382,6 +1414,7 @@
+ gnu_ld=yes
+ ;;
+ x86_64-*-openbsd*)
++ tm_defines="${tm_defines} PIE_DEFAULT=1"
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
+ tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h"
+ extra_options="${extra_options} openbsd.opt"
+@@ -2927,6 +2960,12 @@
+ arch_without_sse2=yes
+ arch_without_64bit=yes
+ ;;
++ i386-*-openbsd*)
++ arch=i486
++ cpu=generic
++ arch_without_sse2=yes
++ arch_without_64bit=yes
++ ;;
+ i386-*-*)
+ arch=i386
+ cpu=i386
+@@ -4109,6 +4148,8 @@
;;
i[34567]86-*-mingw* | x86_64-*-mingw*)
;;
@@ -1416,13 +1512,13 @@
+ gcc_cv_target_dl_iterate_phdr=no
+ fi
+ ;;
-+# *-*-netbsd* | *-*-openbsd*)
-+# if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then
-+# gcc_cv_target_dl_iterate_phdr=yes
-+# else
-+# gcc_cv_target_dl_iterate_phdr=no
-+# fi
-+# ;;
++ *-*-netbsd*)
++ if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then
++ gcc_cv_target_dl_iterate_phdr=yes
++ else
++ gcc_cv_target_dl_iterate_phdr=no
++ fi
++ ;;
esac
if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
diff --git a/lang/gcc-aux/options.mk b/lang/gcc-aux/options.mk
index 6598fe67e32..34b79d0560d 100644
--- a/lang/gcc-aux/options.mk
+++ b/lang/gcc-aux/options.mk
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.3 2014/05/09 09:50:47 marino Exp $
+# $NetBSD: options.mk,v 1.4 2014/05/13 08:18:04 marino Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.gcc-aux
PKG_SUPPORTED_OPTIONS= fortran objc testsuite nls static bootstrap
@@ -58,8 +58,8 @@ APPLY_DIFFS+= fortran-testsuite
USE_BUILTIN.iconv= no
USE_TOOLS+= msgfmt
EXTRA_CONFARGS+= --enable-nls
-EXTRA_CONFARGS+= --with-libiconv-prefix=${PREFIX}
-MY_MAKE_ENV+= ICONVPREFIX=${PREFIX}
+EXTRA_CONFARGS+= --with-libiconv-prefix=${BUILDLINK_PREFIX.iconv}
+MY_MAKE_ENV+= ICONVPREFIX=${BUILDLINK_PREFIX.iconv}
.include "../../converters/libiconv/buildlink3.mk"
.include "../../devel/gettext-lib/buildlink3.mk"
.else
@@ -71,7 +71,11 @@ EXTRA_CONFARGS+= --disable-nls
## STATICALLY BUILT OPTION ##
###############################
-.if !empty(PKG_OPTIONS:Mstatic) && empty(PKG_OPTIONS:Mbootstrap)
+.if !empty(PKG_OPTIONS:Mstatic)
+STATIC_BUILD = yes
+.endif
+
+.if defined(STATIC_BUILD) && empty(PKG_OPTIONS:Mbootstrap)
. if ${OPSYS} == SunOS
PKG_FAIL_REASON+= SunOS does not support static builds
. else
@@ -84,12 +88,15 @@ EXTRA_CONFARGS+= --with-stage1-ldflags=-static
## BOOTSTRAP COMPILER OPTION ##
#################################
-# Solaris does not support static linking, so bootstraps on SunOS require
-# gmp&co to be built with gcc. In addition, the multilib-bootstrap compiler
-# will choke on the 32ELF gmp&co libraries on i836 targets. It's extra work
-# but always rebuilding these libraries solves both issues on SunOS.
+# Solaris does not support static linking system libraries, so bootstraps
+# on SunOS require gmp&co to be built with gcc. Also, OpenBSD x86-64
+# fails configuration during the linking of -lmpc -lmpfr -lgmp in a contest;
+# it complains of missing references in libm. These libraries are built by
+# a different compiler (the base) so perhaps that's the problem. Building
+# gmp&co in the tree allows the configure step to succeed on OpenBSD.
-.if ${OPSYS} == SunOS && !empty(PKG_OPTIONS:Mbootstrap)
+.if ${OPSYS} == OpenBSD || ${OPSYS} == MirBSD || \
+ (${OPSYS} == SunOS && !empty(PKG_OPTIONS:Mbootstrap))
.include "../../devel/gmp/inplace.mk"
.include "../../math/mpcomplex/inplace.mk"
.include "../../math/mpfr/inplace.mk"