Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jun 2015 19:59:56 +0000 (UTC)
From:      Andreas Tobler <andreast@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r388996 - in head/lang/gcc49: . files
Message-ID:  <201506091959.t59Jxu95086518@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andreast (src committer)
Date: Tue Jun  9 19:59:56 2015
New Revision: 388996
URL: https://svnweb.freebsd.org/changeset/ports/388996

Log:
  Backport PIE support for FreeBSD from GCC trunk.
  
  Approved by:	gerald

Added:
  head/lang/gcc49/files/patch-pie-support   (contents, props changed)
Modified:
  head/lang/gcc49/Makefile

Modified: head/lang/gcc49/Makefile
==============================================================================
--- head/lang/gcc49/Makefile	Tue Jun  9 19:57:04 2015	(r388995)
+++ head/lang/gcc49/Makefile	Tue Jun  9 19:59:56 2015	(r388996)
@@ -3,6 +3,7 @@
 
 PORTNAME=	gcc
 PORTVERSION=	4.9.3.s20150520
+PORTREVISION=	1
 CATEGORIES=	lang java
 MASTER_SITES=	GCC/snapshots/${DISTVERSION}
 PKGNAMESUFFIX=	${SUFFIX}

Added: head/lang/gcc49/files/patch-pie-support
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/gcc49/files/patch-pie-support	Tue Jun  9 19:59:56 2015	(r388996)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506091959.t59Jxu95086518>