[google/gcc-4_9] Add gcc driver option -no-pie
Sriraman Tallam
tmsriram@google.com
Mon Oct 6 21:26:00 GMT 2014
Hi,
A build tool we are using adds -pie by default and I am adding
-no-pie to override this when necessary.
Is this patch alright? Would this be suitable for trunk?
Thanks
Sri
-------------- next part --------------
Add a negative for option -pie: -no-pie builds a position dependent executable.
Note that -no-pie also negates a prior -shared.
Index: testsuite/gcc.dg/option_no-pie.c
===================================================================
--- testsuite/gcc.dg/option_no-pie.c (revision 0)
+++ testsuite/gcc.dg/option_no-pie.c (revision 0)
@@ -0,0 +1,7 @@
+/* { dg-do link { target pie } } */
+/* { dg-options "-no-pie" } */
+
+int main(void)
+{
+ return 0;
+}
Index: common.opt
===================================================================
--- common.opt (revision 212826)
+++ common.opt (working copy)
@@ -2841,7 +2841,7 @@ x
Driver Joined Separate
shared
-Driver RejectNegative Negative(pie)
+Driver RejectNegative Negative(no-pie)
Create a shared library
shared-libgcc
@@ -2885,6 +2885,10 @@ Driver
symbolic
Driver
+no-pie
+Driver RejectNegative Negative(pie)
+Create a position dependent executable
+
pie
Driver RejectNegative Negative(shared)
Create a position independent executable
Index: gcc.c
===================================================================
--- gcc.c (revision 212826)
+++ gcc.c (working copy)
@@ -672,9 +672,9 @@ proper position among the other output files. */
#ifndef LINK_PIE_SPEC
#ifdef HAVE_LD_PIE
-#define LINK_PIE_SPEC "%{pie:-pie} "
+#define LINK_PIE_SPEC "%{pie:-pie} %{no-pie:}"
#else
-#define LINK_PIE_SPEC "%{pie:} "
+#define LINK_PIE_SPEC "%{pie:} %{no-pie:}"
#endif
#endif
@@ -3135,6 +3135,7 @@ display_help (void)
fputs (_(" -c Compile and assemble, but do not link\n"), stdout);
fputs (_(" -o <file> Place the output into <file>\n"), stdout);
fputs (_(" -pie Create a position independent executable\n"), stdout);
+ fputs (_(" -no-pie Create a position dependent executable\n"), stdout);
fputs (_(" -shared Create a shared library\n"), stdout);
fputs (_("\
-x <language> Specify the language of the following input files\n\
More information about the Gcc-patches
mailing list