summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorhans <hans>2011-10-13 10:39:45 +0000
committerhans <hans>2011-10-13 10:39:45 +0000
commit460c06192f255d62db3fedc9746648f6d59651d3 (patch)
tree86961945165548a1e77f0c7dc219c9c99e247464 /lang
parent416f3a514a0019f781bb50d9be874aed85a869c1 (diff)
downloadpkgsrc-460c06192f255d62db3fedc9746648f6d59651d3.tar.gz
Add SunOS specifics from lang/gcc44. This includes linker/assembler
selection, objdump detection and the SunOS 5.10 ld workaround.
Diffstat (limited to 'lang')
-rw-r--r--lang/gcc46/Makefile19
-rw-r--r--lang/gcc46/buildlink3.mk10
-rw-r--r--lang/gcc46/files/values.c64
3 files changed, 91 insertions, 2 deletions
diff --git a/lang/gcc46/Makefile b/lang/gcc46/Makefile
index b27557a27ba..6eb23566cd6 100644
--- a/lang/gcc46/Makefile
+++ b/lang/gcc46/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2011/10/13 10:28:30 hans Exp $
+# $NetBSD: Makefile,v 1.5 2011/10/13 10:39:45 hans Exp $
DISTNAME= gcc-${GCC_VERSION}
PKGNAME= gcc46-${GCC_VERSION}
@@ -39,6 +39,16 @@ UNLIMIT_RESOURCES+= stacksize
.include "options.mk"
# Determine whether to use binutils
+.if ${OPSYS} == "SunOS"
+CONFIGURE_ENV+= OBJDUMP=/usr/sfw/bin/gobjdump
+CONFIGURE_ARGS+= --without-gnu-ld --with-ld=/usr/ccs/bin/ld
+. if !exists(/usr/sfw/bin/gas)
+CONFIGURE_ARGS+= --without-gnu-as --with-as=/usr/ccs/bin/as
+. else
+CONFIGURE_ARGS+= --with-gnu-as --with-as=/usr/sfw/bin/gas
+. endif
+.endif
+
# REPLACE_AWK+= gcc/testsuite/gcc.test-framework/test-framework.awk \
# gcc/mkmap-symver.awk \
@@ -186,6 +196,13 @@ do-install:
(cd ${WRKDIR}/obj && ${SETENV} ${MAKE_ENV} ${GMAKE} install DESTDIR=${DESTDIR} \
&& ${TEST} -f ${DESTDIR}${GCC_PREFIX}/bin/cc || ${LN} -f ${DESTDIR}${GCC_PREFIX}/bin/gcc ${DESTDIR}${GCC_PREFIX}/bin/cc)
+.if ${OPSYS} == "SunOS" && ${OS_VERSION} != "5.11" &&
+!empty(MACHINE_ARCH:M*86*)
+post-install:
+ -${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m32
+ -${SH} files/values.c ${DESTDIR}${GCC_PREFIX}/bin/gcc -m64
+.endif
+
GENERATE_PLIST+= \
cd ${DESTDIR}${PREFIX} && ${FIND} ${GCC_SUBPREFIX} \( -type f -o -type l \) -print \
| ${SORT} ;
diff --git a/lang/gcc46/buildlink3.mk b/lang/gcc46/buildlink3.mk
index 10097e8d450..6178de11535 100644
--- a/lang/gcc46/buildlink3.mk
+++ b/lang/gcc46/buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.1.1.1 2011/05/15 00:09:55 wiz Exp $
+# $NetBSD: buildlink3.mk,v 1.2 2011/10/13 10:39:45 hans Exp $
BUILDLINK_TREE+= gcc46
@@ -49,6 +49,14 @@ BUILDLINK_FILES_CMD.gcc46= \
${FIND} ${_GCC46_SUBDIR}/bin ${_GCC46_SUBDIR}/libexec ${_GCC46_SUBDIR}/lib \( -type f -o -type l \) -print)
BUILDLINK_FNAME_TRANSFORM.gcc46= -e s:buildlink:buildlink/gcc46:
+# When not using the GNU linker, gcc will always link shared libraries
+# against the shared version of libgcc. Always enable _USE_GCC_SHILB on
+# platforms that don't use the GNU linker, such as SunOS.
+.include "../../mk/bsd.prefs.mk"
+.if ${OPSYS} == "SunOS"
+_USE_GCC_SHLIB= yes
+.endif
+
# Packages that link against shared libraries need a full dependency.
.if defined(_USE_GCC_SHLIB)
BUILDLINK_DEPMETHOD.gcc46+= full
diff --git a/lang/gcc46/files/values.c b/lang/gcc46/files/values.c
new file mode 100644
index 00000000000..cefb7923e7e
--- /dev/null
+++ b/lang/gcc46/files/values.c
@@ -0,0 +1,64 @@
+#if 0 /* $NetBSD: values.c,v 1.1 2011/10/13 10:39:45 hans Exp $ */
+#
+# This is Solaris x86 specific GCC run-time environment patch, which
+# makes it possible to reliably deploy .init snippets. Trouble is that
+# Solaris linker erroneously pads .init segment with zeros [instead of
+# nops], which is bound to SEGV early upon program start-up. This bug
+# was recognized by GCC team [it is mentioned in source code], but
+# workaround apparently and obviously erroneously slipped away in some
+# newer GCC release. This patch compensates for this mishap by dropping
+# modified values-X*.o into GCC installation tree. Object modules in
+# question are normally provided by Sun and linked prior crtbegin.o.
+# Modified versions are additionally crafted with custom .init segment,
+# which does some magic:-)
+# <appro@fy.chalmers.se>
+set -e
+gcc=gcc
+if [[ "x$1" = x*gcc ]]; then
+ gcc=$1; shift
+fi
+gcc_dir=`${gcc} "$@" -print-libgcc-file-name`
+gcc_dir=${gcc_dir%/*} #*/
+set -x
+${gcc} "$@" -c -o $gcc_dir/values-Xa.o -DXa $0
+${gcc} "$@" -c -o $gcc_dir/values-Xc.o -DXc $0
+${gcc} "$@" -c -o $gcc_dir/values-Xt.o -DXt $0
+exit
+#endif
+
+#include <math.h>
+
+#if defined(Xa)
+const enum version _lib_version = ansi_1;
+#elif defined(Xc)
+const enum version _lib_version = strict_ansi;
+#elif defined(Xt)
+const enum version _lib_version = c_issue_4;
+#else
+#error "compile by issuing 'ksh -f values.c [gcc] [-m64]'"
+#endif
+
+#if defined(__x86_64__)
+asm("\n"
+".section .init\n"
+".align 1\n"
+" leaq 1f(%rip),%rax\n"
+"1: cmpl $0,2f-1b(%rax)\n"
+" jne 2f\n"
+" jmp 2f+5\n"
+" .skip 9\n" /* pad up to 0x1b bytes */
+"2:\n"
+);
+#else
+asm("\n"
+".section .init\n"
+".align 1\n"
+" call 1f\n"
+"1: popl %eax\n"
+" cmpl $0,2f-1b(%eax)\n"
+" jne 2f\n"
+" jmp 2f+5\n"
+" .skip 10\n" /* pad up to 0x1b bytes */
+"2:\n"
+);
+#endif