Add check_effective_target_pie
authorH.J. Lu <hongjiu.lu@intel.com>
Tue, 13 Jan 2015 20:05:41 +0000 (20:05 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Tue, 13 Jan 2015 20:05:41 +0000 (12:05 -0800)
* gcc.target/i386/pie.c: New test.

* lib/target-supports.exp (check_effective_target_pie): New.

From-SVN: r219553

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pie.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp

index 3263f13c58dd4d02fd7a661e27a7017c10b9fac3..24e8b25de59dcedd2a79df1ebde91fce5aefa05a 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * gcc.target/i386/pie.c: New test.
+
+       * lib/target-supports.exp (check_effective_target_pie): New.
+
 2015-01-13  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/64286
diff --git a/gcc/testsuite/gcc.target/i386/pie.c b/gcc/testsuite/gcc.target/i386/pie.c
new file mode 100644 (file)
index 0000000..0a9f5ee
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target pie } } */
+/* { dg-options "-O2" } */
+
+int foo (void);
+
+int
+main (void)
+{
+  return foo ();
+}
+
+/* { dg-final { scan-assembler "foo@PLT" } } */
index f5c6db851fc92a9bfd6e314d84c921cc7223f7f4..0ac96466d4ba362cdbfa379ad049aa666493db02 100644 (file)
@@ -1080,6 +1080,16 @@ proc check_effective_target_nonpic { } {
     }]
 }
 
+# Return 1 if the current multilib generates PIE by default.
+
+proc check_effective_target_pie { } {
+    return [check_no_compiler_messages pie assembly {
+       #ifndef __PIE__
+       #error unsupported
+       #endif
+    }]
+}
+
 # Return 1 if the target does not use a status wrapper.
 
 proc check_effective_target_unwrapped { } {