development/gcc-d: Added (D support for GCC).

Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
This commit is contained in:
Eugene Wissner 2017-09-23 00:46:41 +01:00 committed by David Spencer
parent c03f9014e6
commit 061a158216
7 changed files with 366 additions and 0 deletions

15
development/gcc-d/README Normal file
View file

@ -0,0 +1,15 @@
This is GDC (GNU D Compiler), the D frontend for GCC.
D is a general-purpose programming language with static typing,
systems-level access, and C-like syntax. It combines efficiency,
control and modeling power with safety and programmer productivity.
This package is for GCC 5.3.0 shipped with Slackware. It doesn't
replace any of GCC stock files, so it should be safe to uninstall it.
If it breaks your GCC installation nevertheless, please let me know.
GDC version provided by this package is the latest from the official
"gcc5" branch. Please note that GDC doesn't support all the latest
features supported by the corresponding DMD version.
GDC doesn't conflict with DMD, they can be installed and used together.

View file

@ -0,0 +1,3 @@
if [ -x /usr/bin/install-info ]; then
chroot . /usr/bin/install-info --info-dir=/usr/info /usr/info/gdc.info.gz 2> /dev/null
fi

View file

@ -0,0 +1,180 @@
#!/bin/sh
# Slackware build script for gcc-d
# Copyright 2017 Eugene Wissner, Dachau, Germany
#
# Based on the GCC build script by Patrick J. Volkerding, Sebeka, MN, USA
#
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=gcc-d
SRCNAM=gdc
VERSION=${VERSION:-2.076.0_b1}
GCC_VERSION=5.3.0
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
i?86) ARCH=i586 ;;
arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
*) ARCH=$(uname -m) ;;
esac
export ARCH
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
LIB_ARCH=i386
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
LIB_ARCH=i386
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
LIB_ARCH=amd64
elif [ "$ARCH" = "armv7hl" ]; then
SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
LIBDIRSUFFIX=""
LIB_ARCH=armv7hl
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
LIB_ARCH=$ARCH
fi
case "$ARCH" in
arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
*) TARGET=$ARCH-slackware-linux ;;
esac
# Create directories.
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION gcc-$GCC_VERSION
tar xvf $CWD/gcc-$GCC_VERSION.tar.?z*
tar xvf $CWD/$SRCNAM-$VERSION.tar.?z*
# Apply patches.
cd $TMP/gcc-$GCC_VERSION/gcc
cat $CWD/gcc.66782.diff | patch -p0 --verbose
cat $CWD/gcc.69140.diff | patch -p2 --verbose
cd $TMP/$SRCNAM-$VERSION
sh setup-gcc.sh ../gcc-$GCC_VERSION
cd $TMP/gcc-$GCC_VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
if [ "$ARCH" != "x86_64" ]; then
GCC_ARCHOPTS="--with-arch=$ARCH"
else
GCC_ARCHOPTS="--disable-multilib"
fi
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
../gcc-$GCC_VERSION/configure \
--prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--mandir=/usr/man \
--infodir=/usr/info \
--enable-shared \
--disable-bootstrap \
--enable-languages=c,c++,d \
--enable-threads=posix \
--enable-checking=release \
--with-system-zlib \
--with-python-dir=/lib$LIBDIRSUFFIX/python2.7/site-packages \
--enable-libstdcxx-dual-abi \
--disable-libunwind-exceptions \
--enable-__cxa_atexit \
--enable-libssp \
--enable-lto \
--disable-install-libiberty \
--with-gnu-ld \
--verbose \
--with-arch-directory=$LIB_ARCH \
$GCC_ARCHOPTS \
--target=${TARGET} \
--build=${TARGET} \
--host=${TARGET}
make
make install DESTDIR=$PKG
# Remove not D related stuff, already available in GCC
find $PKG/usr/bin -type f -not -name "*gdc*" -delete
find $PKG/usr/info -type f -not -name "*gdc*" -delete
find $PKG/usr/man/man1 -type f -not -name "*gdc*" -delete
rm -r $PKG/usr/man/man7
rm -r $PKG/usr/share
rm -r $PKG/usr/include
rm -r $PKG/usr/lib$LIBDIRSUFFIX/python2.7
find $PKG/usr/libexec/gcc \
\( -type f -or -type l \) -not -name "cc1d" \
-delete
find $PKG/usr/lib$LIBDIRSUFFIX/gcc -mindepth 3 \
\( -type f -or -type l \) -not -regex ".*/d/.*" \
-delete
find $PKG/usr/lib$LIBDIRSUFFIX -maxdepth 1 \
\( -type f -or -type l \) \
-not \( -name "*phobos*" -or -name "*gdruntime*" \) \
-delete
find $PKG/usr -type d -empty -delete
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
gzip -9 $PKG/usr/info/*.info
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp $TMP/$SRCNAM-$VERSION/README.md $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -0,0 +1,12 @@
PRGNAM="gcc-d"
VERSION="2.076.0_b1"
HOMEPAGE="https://www.gdcproject.org/"
DOWNLOAD="http://download.dlackware.com/slackware/slackware64-14.2/source/d/gcc/gcc-5.3.0.tar.xz \
http://download.dlackware.com/hosted-sources/gcc-d/gdc-2.076.0_b1.tar.xz"
MD5SUM="174cf91eff44e44205306245949ae19a \
030b9ae0178be69279222cf7f82dd8a6"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Eugene Wissner"
EMAIL="belka@caraus.de"

View file

@ -0,0 +1,124 @@
Index: config/i386/i386.md
===================================================================
--- config/i386/i386.md (revision 225539)
+++ config/i386/i386.md (working copy)
@@ -108,6 +108,7 @@
UNSPEC_LD_MPIC ; load_macho_picbase
UNSPEC_TRUNC_NOOP
UNSPEC_DIV_ALREADY_SPLIT
+ UNSPEC_MS_TO_SYSV_CALL
UNSPEC_PAUSE
UNSPEC_LEA_ADDR
UNSPEC_XBEGIN_ABORT
@@ -11584,6 +11585,15 @@
"* return ix86_output_call_insn (insn, operands[0]);"
[(set_attr "type" "call")])
+(define_insn "*call_rex64_ms_sysv"
+ [(match_parallel 2 "call_rex64_ms_sysv_operation"
+ [(call (mem:QI (match_operand:DI 0 "call_insn_operand" "rBwBz"))
+ (match_operand 1))
+ (unspec [(const_int 0)] UNSPEC_MS_TO_SYSV_CALL)])]
+ "TARGET_64BIT && !SIBLING_CALL_P (insn)"
+ "* return ix86_output_call_insn (insn, operands[0]);"
+ [(set_attr "type" "call")])
+
(define_insn "*sibcall"
[(call (mem:QI (match_operand:W 0 "sibcall_insn_operand" "UBsBz"))
(match_operand 1))]
@@ -11808,6 +11818,16 @@
(match_dup 3)))
(unspec [(const_int 0)] UNSPEC_PEEPSIB)])])
+(define_insn "*call_value_rex64_ms_sysv"
+ [(match_parallel 3 "call_rex64_ms_sysv_operation"
+ [(set (match_operand 0)
+ (call (mem:QI (match_operand:DI 1 "call_insn_operand" "rBwBz"))
+ (match_operand 2)))
+ (unspec [(const_int 0)] UNSPEC_MS_TO_SYSV_CALL)])]
+ "TARGET_64BIT && !SIBLING_CALL_P (insn)"
+ "* return ix86_output_call_insn (insn, operands[1]);"
+ [(set_attr "type" "callv")])
+
(define_expand "call_value_pop"
[(parallel [(set (match_operand 0)
(call (match_operand:QI 1)
Index: config/i386/predicates.md
===================================================================
--- config/i386/predicates.md (revision 225533)
+++ config/i386/predicates.md (working copy)
@@ -616,6 +616,36 @@
&& XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL);
})
+;; Return true if OP is a call from MS ABI to SYSV ABI function.
+(define_predicate "call_rex64_ms_sysv_operation"
+ (match_code "parallel")
+{
+ unsigned creg_size = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
+ unsigned i;
+
+ if ((unsigned) XVECLEN (op, 0) != creg_size + 2)
+ return false;
+
+ for (i = 0; i < creg_size; i++)
+ {
+ rtx elt = XVECEXP (op, 0, i+2);
+ enum machine_mode mode;
+ unsigned regno;
+
+ if (GET_CODE (elt) != CLOBBER
+ || GET_CODE (SET_DEST (elt)) != REG)
+ return false;
+
+ regno = x86_64_ms_sysv_extra_clobbered_registers[i];
+ mode = SSE_REGNO_P (regno) ? TImode : DImode;
+
+ if (GET_MODE (SET_DEST (elt)) != mode
+ || REGNO (SET_DEST (elt)) != regno)
+ return false;
+ }
+ return true;
+})
+
;; Match exactly zero.
(define_predicate "const0_operand"
(match_code "const_int,const_wide_int,const_double,const_vector")
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 225533)
+++ config/i386/i386.c (working copy)
@@ -25639,7 +25639,9 @@
rtx callarg2,
rtx pop, bool sibcall)
{
- rtx vec[3];
+ unsigned int const cregs_size
+ = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
+ rtx vec[3 + cregs_size];
rtx use = NULL, call;
unsigned int vec_len = 0;
@@ -25742,16 +25744,18 @@
if (TARGET_64BIT_MS_ABI
&& (!callarg2 || INTVAL (callarg2) != -2))
{
- int const cregs_size
- = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
- int i;
+ unsigned i;
+ vec[vec_len++] = gen_rtx_UNSPEC (VOIDmode, gen_rtvec (1, const0_rtx),
+ UNSPEC_MS_TO_SYSV_CALL);
+
for (i = 0; i < cregs_size; i++)
{
int regno = x86_64_ms_sysv_extra_clobbered_registers[i];
machine_mode mode = SSE_REGNO_P (regno) ? TImode : DImode;
- clobber_reg (&use, gen_rtx_REG (mode, regno));
+ vec[vec_len++]
+ = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (mode, regno));
}
}

View file

@ -0,0 +1,13 @@
--- ./gcc/config/i386/i386.c.orig 2015-11-18 09:45:26.000000000 -0600
+++ ./gcc/config/i386/i386.c 2016-02-05 13:50:07.202981920 -0600
@@ -9677,6 +9677,10 @@
if (TARGET_64BIT_MS_ABI && get_frame_size () > SEH_MAX_FRAME_SIZE)
return true;
+ /* SSE saves require frame-pointer when stack is misaligned. */
+ if (TARGET_64BIT_MS_ABI && ix86_incoming_stack_boundary < 128)
+ return true;
+
/* In ix86_option_override_internal, TARGET_OMIT_LEAF_FRAME_POINTER
turns off the frame pointer by default. Turn it back on now if
we've not got a leaf function. */

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
gcc-d: gcc-d (D support for GCC)
gcc-d:
gcc-d: GCC is the GNU Compiler Collection.
gcc-d:
gcc-d: D is a general-purpose programming language with static typing,
gcc-d: systems-level access, and C-like syntax. It combines efficiency,
gcc-d: control and modeling power with safety and programmer productivity.
gcc-d:
gcc-d: Homepage: https://www.gdcproject.org
gcc-d:
gcc-d: