diff mbox

[testsuite] Run TLS torture tests with -fpic etc.

Message ID yddsjrh7o2h.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth June 10, 2011, 2:34 p.m. UTC
"Joseph S. Myers" <joseph@codesourcery.com> writes:

> On Fri, 10 Jun 2011, Rainer Orth wrote:
>
>> Jakub Jelinek <jakub@redhat.com> writes:
>> 
>> > On Tue, Jun 07, 2011 at 06:48:08PM +0200, Rainer Orth wrote:
>> >> any word on this patch?   I think I only need approval for the gcc.c
>> >
>> > I'm not a maintainer of gcc.c, and I think it is a bad idea.
>> > PIE is just a (slightly) more secure form of an executable, therefore
>> > if a target doesn't support position independent executables, linking
>> > it as normal executable is IMHO just fine.
>> 
>> Joseph, as driver maintainer, what's your take on this?
>> 
>> 	http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00373.html
>> 
>> If the gcc.c change is unacceptable, I'll change the pie
>> effective-target keyword to just check for darwin9+ and linux instead.
>
> I think we should leave gcc.c as-is here, treating -pie as a non-semantic 
> option.

Ok, I've comitted that patch as follows, after running the appropriate
runtest invocation on powerpc-apple-darwin9.8.0 and i386-pc-solaris2.10.

I've omitted adding -pie in gcc.dg/pie-link.c for now.

	Rainer


2011-06-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	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.
diff mbox

Patch

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	(revision 174908)
+++ gcc/doc/sourcebuild.texi	(working copy)
@@ -1787,6 +1787,9 @@ 
 @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.
 
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 174908)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -788,6 +788,16 @@ 
     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 { } {
Index: gcc/testsuite/gcc.dg/pie-link.c
===================================================================
--- gcc/testsuite/gcc.dg/pie-link.c	(revision 174908)
+++ gcc/testsuite/gcc.dg/pie-link.c	(working copy)
@@ -1,4 +1,4 @@ 
-/* { dg-do link { target *-*-darwin[912]* *-*-linux* } } */
+/* { dg-do link { target pie } } */
 /* { dg-options "-fpie" } */
 
 int main(void)