From 8340fbd7fe1fe08a60d5a5876512e8e067db236e Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Fri, 10 Jun 2011 14:31:31 +0000
Subject: [PATCH] sourcebuild.texi (Effective-Target Keywords, pie): Document
 it.

	gcc:
	* doc/sourcebuild.texi (Effective-Target Keywords, pie): Document it.

	gcc/testsuite:
	* lib/target-supports.exp (check_effective_target_pie): New proc.
	* gcc.dg/pie-link.c: Use target pie.

From-SVN: r174909
---
 gcc/ChangeLog                         |  4 ++++
 gcc/doc/sourcebuild.texi              |  3 +++
 gcc/testsuite/ChangeLog               |  5 +++++
 gcc/testsuite/gcc.dg/pie-link.c       |  2 +-
 gcc/testsuite/lib/target-supports.exp | 10 ++++++++++
 5 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc2e04ac1e9e..aeab479d8343 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2011-06-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* doc/sourcebuild.texi (Effective-Target Keywords, pie): Document it.
+
 2011-06-10  Hans-Peter Nilsson  <hp@axis.com>
 
 	* ira-costs.c: Remove #ifdefs on dead FORBIDDEN_INC_DEC_CLASSES.
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 64210c21bc92..d2cc4ea3ead4 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1787,6 +1787,9 @@ Target defines @code{PCC_BITFIELD_TYPE_MATTERS}.
 @item pe_aligned_commons
 Target supports @option{-mpe-aligned-commons}.
 
+@item pie
+Target supports @option{-pie}, @option{-fpie} and @option{-fPIE}.
+
 @item section_anchors
 Target supports section anchors.
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 31f5d1e65c89..4ffc08152a7c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* lib/target-supports.exp (check_effective_target_pie): New proc.
+	* gcc.dg/pie-link.c: Use target pie.
+
 2011-06-10  Eric Botcazou  <ebotcazou@adacore.com>
 	    Laurent Rougé  <laurent.rouge@menta.fr>
 
diff --git a/gcc/testsuite/gcc.dg/pie-link.c b/gcc/testsuite/gcc.dg/pie-link.c
index 00ff49597ed8..c16086cc19eb 100644
--- a/gcc/testsuite/gcc.dg/pie-link.c
+++ b/gcc/testsuite/gcc.dg/pie-link.c
@@ -1,4 +1,4 @@
-/* { dg-do link { target *-*-darwin[912]* *-*-linux* } } */
+/* { dg-do link { target pie } } */
 /* { dg-options "-fpie" } */
 
 int main(void)
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 7d3a27135f5d..1f6f8b6ba4e6 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -788,6 +788,16 @@ proc check_effective_target_fpic { } {
     return 0
 }
 
+# Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
+
+proc check_effective_target_pie { } {
+    if { [istarget *-*-darwin\[912\]*]
+	 || [istarget *-*-linux*] } {
+	return 1;
+    }
+    return 0
+}
+
 # Return true if the target supports -mpaired-single (as used on MIPS).
 
 proc check_effective_target_mpaired_single { } {
-- 
GitLab