pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/lang/gcc-aux lang/gcc-aux: Enable dl_iterate_phdr and ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/d38a3fbf30fa
branches: trunk
changeset: 634251:d38a3fbf30fa
user: marino <marino%pkgsrc.org@localhost>
date: Tue May 13 08:18:04 2014 +0000
description:
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:
lang/gcc-aux/Makefile | 48 +++++++++++++----
lang/gcc-aux/files/diff-ada | 8 +-
lang/gcc-aux/files/diff-core | 114 +++++++++++++++++++++++++++++++++++++++---
lang/gcc-aux/options.mk | 25 ++++++---
4 files changed, 160 insertions(+), 35 deletions(-)
diffs (truncated from 360 to 300 lines):
diff -r bc6d0bb3df89 -r d38a3fbf30fa lang/gcc-aux/Makefile
--- a/lang/gcc-aux/Makefile Tue May 13 07:48:29 2014 +0000
+++ b/lang/gcc-aux/Makefile Tue May 13 08:18:04 2014 +0000
@@ -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 @@
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 @@
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 @@
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 @@
.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 @@
. 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 @@
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 @@
-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 -r bc6d0bb3df89 -r d38a3fbf30fa lang/gcc-aux/files/diff-ada
--- a/lang/gcc-aux/files/diff-ada Tue May 13 07:48:29 2014 +0000
+++ b/lang/gcc-aux/files/diff-ada Tue May 13 08:18:04 2014 +0000
@@ -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 -r bc6d0bb3df89 -r d38a3fbf30fa lang/gcc-aux/files/diff-core
--- a/lang/gcc-aux/files/diff-core Tue May 13 07:48:29 2014 +0000
+++ b/lang/gcc-aux/files/diff-core Tue May 13 08:18:04 2014 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index