@@ -0,0 +1,12 @@
+/* { dg-do compile { target *-*-linux* *-*-gnu* } } */
+/* { dg-require-effective-target default_pie } */
Why restrict to Linux, GNU? default_pie should be enough once other
targets add this.
@@ -2,6 +2,9 @@
/* Skipped on MIPS GNU/Linux target because __PIC__ can be
defined for executables as well as shared libraries. */
/* { dg-skip-if "" { *-*-darwin* hppa*64*-*-* mips*-*-linux* *-*-mingw* } { "*" } { "" } } */
+/* Skipped on default_pie targets because __PIC__ is
+ defined for executables. */
+/* { dg-skip-if "" { default_pie } { "*" } { "" } } */
Emit those default args, they're unnecessary. Also in g++.dg/other/anon5.C.
@@ -1,5 +1,6 @@
// PR c++/34094
// { dg-do link { target { ! { *-*-darwin* *-*-hpux* *-*-solaris2.* } } } }
+// { dg-skip-if "" { default_pie } { "*" } { "" } }
The first arg to dg-skip-if should explain why you're skipping the test.
@@ -474,6 +474,11 @@ proc check_profiling_available { test_wh
}
}
+ # Profiling don't work with default -fPIE -pie.
Grammar: "doesn't work".
+# Return 1 if -pie, -fPIE are default enable, 0 otherwise.
+
+proc check_effective_target_default_pie { } {
Hard to understand, perhaps
# Return 1 if -pie -fPIE are enabled by default, 0 otherwise.
@@ -10535,6 +10535,12 @@ For predictable results, you must also s
used for compilation (@option{-fpie}, @option{-fPIE},
or model suboptions) when you specify this linker option.
+NOTE: With configure --enable-default-pie this option is enabled by default
With the @option{--enable-default-pie} configure option, ...
+for C, C++, ObjC, ObjC++, if none of @option{-fno-PIE}, @option{-fno-pie},
+@option{-fPIC}, @option{-fpic}, @option{-fno-PIC}, @option{-fno-pic},
+@option{-nostdlib}, @option{-nostartfiles}, @option{-shared},
+@option{-nodefaultlibs}, nor @option{static} are found.