aboutsummaryrefslogtreecommitdiffstats
path: root/lang/gcc9-devel
diff options
context:
space:
mode:
authorandreast <andreast@FreeBSD.org>2019-03-20 06:03:17 +0800
committerandreast <andreast@FreeBSD.org>2019-03-20 06:03:17 +0800
commit2b00094ed1813a11623d0998f202bdeec862b966 (patch)
treef859f5bf858f385085ac94e94f0c5e690f4bbd61 /lang/gcc9-devel
parentacd4a23acbb70ad8c9476ea39f6fa3e99473f5ed (diff)
downloadfreebsd-ports-gnome-2b00094ed1813a11623d0998f202bdeec862b966.tar.gz
freebsd-ports-gnome-2b00094ed1813a11623d0998f202bdeec862b966.tar.zst
freebsd-ports-gnome-2b00094ed1813a11623d0998f202bdeec862b966.zip
This commit brings multilib support for gcc on amd64. This means you can
compile and execute 32-bit binaries with gcc. The gcc part will be upstreamed as soon as gcc trunk opens for new commits. On the release front, gcc8, we will merge this commit after a week or so. Approved by: gerald@
Diffstat (limited to 'lang/gcc9-devel')
-rw-r--r--lang/gcc9-devel/Makefile4
-rw-r--r--lang/gcc9-devel/files/patch-amd64-gcc-multilib-support73
2 files changed, 76 insertions, 1 deletions
diff --git a/lang/gcc9-devel/Makefile b/lang/gcc9-devel/Makefile
index 711e9182f248..fdf08f981961 100644
--- a/lang/gcc9-devel/Makefile
+++ b/lang/gcc9-devel/Makefile
@@ -49,6 +49,8 @@ BOOTSTRAP_DESC= Build using a full bootstrap
GRAPHITE_DESC= Support for Graphite loop optimizations
.if exists(/usr/lib32/libc.so)
+OPTIONS_DEFINE_amd64+= MULTILIB
+OPTIONS_DEFAULT_amd64+= MULTILIB
OPTIONS_DEFINE_powerpc64+= MULTILIB
OPTIONS_DEFAULT_powerpc64+= MULTILIB
MULTILIB_DESC= Build support for 32-bit and 64-bit targets
@@ -140,7 +142,7 @@ post-stage:
# Add target libraries and include files to packaging list.
${RM} ${WRKDIR}/PLIST.lib
-.if ${ARCH} == powerpc64 && ${PORT_OPTIONS:MMULTILIB}
+.if (${ARCH} == amd64 || ${ARCH} == powerpc64) && ${PORT_OPTIONS:MMULTILIB}
${MKDIR} ${STAGEDIR}${TARGLIB32}
${MV} ${STAGEDIR}${PREFIX}/lib/lib32 ${STAGEDIR}${TARGLIB32}/gcc${SUFFIX}
.endif
diff --git a/lang/gcc9-devel/files/patch-amd64-gcc-multilib-support b/lang/gcc9-devel/files/patch-amd64-gcc-multilib-support
new file mode 100644
index 000000000000..ffae93210614
--- /dev/null
+++ b/lang/gcc9-devel/files/patch-amd64-gcc-multilib-support
@@ -0,0 +1,73 @@
+--- UTC
+Index: gcc/config.gcc
+===================================================================
+--- gcc/config.gcc (revision 269726)
++++ gcc/config.gcc (working copy)
+@@ -4925,8 +4925,11 @@
+ ;;
+ i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
+ ;;
+- i[34567]86-*-freebsd* | x86_64-*-freebsd*)
++ i[34567]86-*-freebsd*)
+ ;;
++ x86_64-*-freebsd*)
++ tmake_file="${tmake_file} i386/t-freebsd64"
++ ;;
+ ia64*-*-linux*)
+ ;;
+
+Index: gcc/config/i386/freebsd64.h
+===================================================================
+--- gcc/config/i386/freebsd64.h (revision 269733)
++++ gcc/config/i386/freebsd64.h (working copy)
+@@ -31,7 +31,7 @@
+
+ #undef LINK_SPEC
+ #define LINK_SPEC "\
+- %{m32:-m elf_i386_fbsd} \
++ %{m32:-m elf_i386_fbsd}%{!m32:-m elf_x86_64_fbsd} \
+ %{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
+ %{v:-V} \
+ %{assert*} %{R*} %{rpath*} %{defsym*} \
+@@ -42,3 +42,6 @@
+ -dynamic-linker %(fbsd_dynamic_linker) } \
+ %{static:-Bstatic}} \
+ %{symbolic:-Bsymbolic}"
++
++#undef MULTILIB_DEFAULTS
++#define MULTILIB_DEFAULTS { "m64" }
+Index: gcc/config/i386/t-freebsd64
+===================================================================
+--- gcc/config/i386/t-freebsd64 (nonexistent)
++++ gcc/config/i386/t-freebsd64 (working copy)
+@@ -0,0 +1,30 @@
++# Copyright (C) 2019 Free Software Foundation, Inc.
++#
++# This file is part of GCC.
++#
++# GCC is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++#
++# GCC is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with GCC; see the file COPYING3. If not see
++# <http://www.gnu.org/licenses/>.
++
++# The 32-bit libraries are found in /usr/lib32
++
++# To support i386 and x86-64, the directory structrue
++# should be:
++#
++# /lib has x86-64 libraries.
++# /lib32 has i386 libraries.
++#
++
++MULTILIB_OPTIONS = m32
++MULTILIB_DIRNAMES = 32
++MULTILIB_OSDIRNAMES = ../lib32