aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl@gcc.gnu.org>2017-08-08 15:06:21 -0700
committerH.J. Lu <hjl@gcc.gnu.org>2017-08-08 15:06:21 -0700
commit7345b714005c24a7d74525cd57562420b3a6d716 (patch)
tree07a5613ddad59abf64333e6a154a92353fc98b9d /gcc/testsuite
parentd5bf81b30f7d3faf58d52784013749ca0f9f980f (diff)
downloadgcc-7345b714005c24a7d74525cd57562420b3a6d716.zip
gcc-7345b714005c24a7d74525cd57562420b3a6d716.tar.gz
gcc-7345b714005c24a7d74525cd57562420b3a6d716.tar.bz2
PR driver/81523: Make -static override -pie
-static and -pie together behave differently depending on whether GCC is configured with --enable-default-pie. On x86, "-static -pie" fails to create executable when --enable-default-pie isn't used, but creates a static executable when --enable-default-pie is used. This patch makes -static completely override -pie to create a static executable, regardless if --enable-default-pie is used to configure GCC. gcc/ PR driver/81523 * gcc.c (NO_PIE_SPEC): Delete. (PIE_SPEC): Define as !no-pie/pie. Move static|shared|r exclusion.. (LINK_PIE_SPEC): ..to here. (LINK_COMMAND_SPEC): Support -no-pie. * config/gnu-user.h (GNU_USER_TARGET_STARTFILE_SPEC): Correct chain of crtbegin*.o selection, update for PIE_SPEC changes and format. (GNU_USER_TARGET_ENDFILE_SPEC): Similarly. * config/sol2.h (STARTFILE_CRTBEGIN_SPEC): Similarly. (ENDFILE_CRTEND_SPEC): Similarly. gcc/testsuite/ PR driver/81523 * gcc.dg/pie-7.c: New test. * gcc.dg/pie-static-1.c: Likewise. * gcc.dg/pie-static-2.c: Likewise. From-SVN: r250974
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.dg/pie-7.c7
-rw-r--r--gcc/testsuite/gcc.dg/pie-static-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/pie-static-2.c7
4 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ec22e8..23fbb8c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2017-08-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR driver/81523
+ * gcc.dg/pie-7.c: New test.
+ * gcc.dg/pie-static-1.c: Likewise.
+ * gcc.dg/pie-static-2.c: Likewise.
+
2017-08-08 Uros Bizjak <ubizjak@gmail.com>
PR target/81708
diff --git a/gcc/testsuite/gcc.dg/pie-7.c b/gcc/testsuite/gcc.dg/pie-7.c
new file mode 100644
index 0000000..e118a98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pie-7.c
@@ -0,0 +1,7 @@
+/* { dg-do run { target pie } } */
+/* { dg-options "-fno-pie -no-pie" } */
+
+int main(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pie-static-1.c b/gcc/testsuite/gcc.dg/pie-static-1.c
new file mode 100644
index 0000000..f3580ef
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pie-static-1.c
@@ -0,0 +1,7 @@
+/* { dg-do run { target pie } } */
+/* { dg-options "-static -fpie -pie" } */
+
+int main(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pie-static-2.c b/gcc/testsuite/gcc.dg/pie-static-2.c
new file mode 100644
index 0000000..49608c5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pie-static-2.c
@@ -0,0 +1,7 @@
+/* { dg-do run { target pie } } */
+/* { dg-options "-fpie -pie -static" } */
+
+int main(void)
+{
+ return 0;
+}