aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authorandreast <andreast@FreeBSD.org>2015-06-10 03:59:56 +0800
committerandreast <andreast@FreeBSD.org>2015-06-10 03:59:56 +0800
commit76651f25184414a9f566b3e350257a76a3d42409 (patch)
tree69e3f32b72b38fe529f0d1363a4170f3127d9c74 /lang
parent4d2050d9498dbf2b96526c56de952417e7a17cc4 (diff)
downloadfreebsd-ports-gnome-76651f25184414a9f566b3e350257a76a3d42409.tar.gz
freebsd-ports-gnome-76651f25184414a9f566b3e350257a76a3d42409.tar.zst
freebsd-ports-gnome-76651f25184414a9f566b3e350257a76a3d42409.zip
Backport PIE support for FreeBSD from GCC trunk.
Approved by: gerald
Diffstat (limited to 'lang')
-rw-r--r--lang/gcc49/Makefile1
-rw-r--r--lang/gcc49/files/patch-pie-support73
2 files changed, 74 insertions, 0 deletions
diff --git a/lang/gcc49/Makefile b/lang/gcc49/Makefile
index c111edd51747..33d056e453c5 100644
--- a/lang/gcc49/Makefile
+++ b/lang/gcc49/Makefile
@@ -3,6 +3,7 @@
PORTNAME= gcc
PORTVERSION= 4.9.3.s20150520
+PORTREVISION= 1
CATEGORIES= lang java
MASTER_SITES= GCC/snapshots/${DISTVERSION}
PKGNAMESUFFIX= ${SUFFIX}
diff --git a/lang/gcc49/files/patch-pie-support b/lang/gcc49/files/patch-pie-support
new file mode 100644
index 000000000000..7fc70b40e715
--- /dev/null
+++ b/lang/gcc49/files/patch-pie-support
@@ -0,0 +1,73 @@
+--- gcc/config/freebsd-spec.h.orig 2015-01-05 13:33:28.000000000 +0100
++++ gcc/config/freebsd-spec.h 2015-05-19 12:13:47.863772000 +0200
+@@ -66,8 +66,9 @@
+ "%{!shared: \
+ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+ %{!p:%{profile:gcrt1.o%s} \
+- %{!profile:crt1.o%s}}}} \
+- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
++ %{!profile: \
++ %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
++ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
+
+ /* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
+ the magical crtend.o file (see crtstuff.c) which provides part of
+@@ -76,7 +77,7 @@
+ `crtn.o'. */
+
+ #define FBSD_ENDFILE_SPEC \
+- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
++ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
+
+ /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
+ required by the user-land thread model. Before __FreeBSD_version
+--- gcc/config/i386/freebsd.h.orig 2015-01-05 13:33:28.000000000 +0100
++++ gcc/config/i386/freebsd.h 2015-05-19 12:13:47.865132000 +0200
+@@ -59,28 +59,15 @@
+ #define SUBTARGET_EXTRA_SPECS \
+ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
+
+-/* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add
+- the magical crtbegin.o file (see crtstuff.c) which provides part
+- of the support for getting C++ file-scope static object constructed
+- before entering `main'. */
+-
+-#undef STARTFILE_SPEC
+-#define STARTFILE_SPEC \
+- "%{!shared: \
+- %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
+- %{!p:%{profile:gcrt1.o%s} \
+- %{!profile:crt1.o%s}}}} \
+- crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
+-
+-/* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
+- the magical crtend.o file (see crtstuff.c) which provides part of
+- the support for getting C++ file-scope static object constructed
+- before entering `main', followed by a normal "finalizer" file,
+- `crtn.o'. */
+-
+-#undef ENDFILE_SPEC
+-#define ENDFILE_SPEC \
+- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
++/* Use the STARTFILE_SPEC from config/freebsd-spec.h. */
++
++#undef STARTFILE_SPEC
++#define STARTFILE_SPEC FBSD_STARTFILE_SPEC
++
++/* Use the ENDFILE_SPEC from config/freebsd-spec.h. */
++
++#undef ENDFILE_SPEC
++#define ENDFILE_SPEC FBSD_ENDFILE_SPEC
+
+ /* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
+ for the special GCC options -static and -shared, which allow us to
+--- gcc/testsuite/lib/target-supports.exp.orig 2015-03-26 00:35:54.000000000 +0100
++++ gcc/testsuite/lib/target-supports.exp 2015-05-19 12:13:47.868191000 +0200
+@@ -952,6 +952,7 @@
+
+ proc check_effective_target_pie { } {
+ if { [istarget *-*-darwin\[912\]*]
++ || [istarget *-*-freebsd*]
+ || [istarget *-*-linux*]
+ || [istarget *-*-gnu*] } {
+ return 1;