Add support for -pie.
authorIan Lance Taylor <ian@airs.com>
Wed, 14 Oct 2009 05:25:02 +0000 (05:25 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 14 Oct 2009 05:25:02 +0000 (05:25 +0000)
* options.h (class General_options): Add -pie and
--pic-executable.
(General_options::output_is_position_independent): Test -pie.
(General_options::output_is_executable): Return true if not shared
and not relocatable.
(General_options::output_is_pie): Remove.
* options.cc (General_options::finalize): Reject incompatible uses
of -pie.
* gold.cc (queue_middle_tasks): A -pie link is not static.
* symtab.h (Symbol::needs_plt_entry): Return false if -pie.
* symtab.cc (Symbol::final_value_is_known): Return false if
output_is_position_independent.
* layout.cc (Layout::set_segment_offsets): Start at address 0 if
output_is_position_independent.
* output.cc (Output_file_header::do_sized_write): Use ET_DYN if
output_is_position_independent.
* i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
output_is_position_independent.
* testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
two_file_pie_test.
(basic_pie_test.o, basic_pie_test): New targets.
(two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
(two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
(two_file_pie_test): New target.
* testsuite/Makefile.in: Rebuild.
* README: Remove note saying that -pie is not supported.

12 files changed:
gold/ChangeLog
gold/README
gold/gold.cc
gold/i386.cc
gold/layout.cc
gold/options.cc
gold/options.h
gold/output.cc
gold/symtab.cc
gold/symtab.h
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in

index c39e44f16c93f049bac401e4797e1b82cf3de1f5..9b0623deddde7cc8af3bb9a66e0852257061d878 100644 (file)
@@ -1,3 +1,33 @@
+2009-10-13  Ian Lance Taylor  <iant@google.com>
+
+       Add support for -pie.
+       * options.h (class General_options): Add -pie and
+       --pic-executable.
+       (General_options::output_is_position_independent): Test -pie.
+       (General_options::output_is_executable): Return true if not shared
+       and not relocatable.
+       (General_options::output_is_pie): Remove.
+       * options.cc (General_options::finalize): Reject incompatible uses
+       of -pie.
+       * gold.cc (queue_middle_tasks): A -pie link is not static.
+       * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
+       * symtab.cc (Symbol::final_value_is_known): Return false if
+       output_is_position_independent.
+       * layout.cc (Layout::set_segment_offsets): Start at address 0 if
+       output_is_position_independent.
+       * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
+       output_is_position_independent.
+       * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
+       output_is_position_independent.
+       * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
+       two_file_pie_test.
+       (basic_pie_test.o, basic_pie_test): New targets.
+       (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
+       (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
+       (two_file_pie_test): New target.
+       * testsuite/Makefile.in: Rebuild.
+       * README: Remove note saying that -pie is not supported.
+
 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
 
        * options.h (class General_options): Add -init and -fini.
index 8891d624d65bbedb26e6c084c3c996504d66b650..80da4558aa7a68d0813e4c2a882fa51a1a2ae5d9 100644 (file)
@@ -18,7 +18,6 @@ gold--are:
   * MEMORY regions in linker scripts
   * MRI compatible linker scripts
   * cross-reference reports (--cref)
-  * position independent executables (-pie)
   * various other minor options
 
 
index 909d7c384532e3e5fc23ac470f7b7df385474af3..4ac1e3dca0388a22efc84801db073f0267f757b5 100644 (file)
@@ -396,8 +396,9 @@ queue_middle_tasks(const General_options& options,
   workqueue->set_thread_count(thread_count);
 
   // Now we have seen all the input files.
-  const bool doing_static_link = (!input_objects->any_dynamic()
-                                 && !parameters->options().shared());
+  const bool doing_static_link =
+    (!input_objects->any_dynamic()
+     && !parameters->options().output_is_position_independent());
   set_parameters_doing_static_link(doing_static_link);
   if (!doing_static_link && options.is_static())
     {
index 18eb8493561f23272d329816cdf495a9e7dd966d..5ac9ff4e75c38ada241cfdf4cf3ae6615f94d359 100644 (file)
@@ -692,7 +692,7 @@ Output_data_plt_i386::do_write(Output_file* of)
   elfcpp::Elf_types<32>::Elf_Addr plt_address = this->address();
   elfcpp::Elf_types<32>::Elf_Addr got_address = this->got_plt_->address();
 
-  if (parameters->options().shared())
+  if (parameters->options().output_is_position_independent())
     memcpy(pov, dyn_first_plt_entry, plt_entry_size);
   else
     {
@@ -724,7 +724,7 @@ Output_data_plt_i386::do_write(Output_file* of)
     {
       // Set and adjust the PLT entry itself.
 
-      if (parameters->options().shared())
+      if (parameters->options().output_is_position_independent())
        {
          memcpy(pov, dyn_plt_entry, plt_entry_size);
          elfcpp::Swap_unaligned<32, false>::writeval(pov + 2, got_offset);
index d198ce24373cd27196fc1e02d2a240a42be00eb1..24965309d0114c87e1db9d71db7ff489adcdcbaf 100644 (file)
@@ -2144,7 +2144,7 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg,
   uint64_t addr;
   if (parameters->options().user_set_Ttext())
     addr = parameters->options().Ttext();
-  else if (parameters->options().shared())
+  else if (parameters->options().output_is_position_independent())
     addr = 0;
   else
     addr = target->default_text_segment_address();
index 5be414def08345e3c59f3466b6f28788437d5e31..299a748048b03ea7cfd4481f0e38209ea9d56c5c 100644 (file)
@@ -1001,17 +1001,24 @@ General_options::finalize()
   // Now that we've normalized the options, check for contradictory ones.
   if (this->shared() && this->is_static())
     gold_fatal(_("-shared and -static are incompatible"));
+  if (this->shared() && this->pie())
+    gold_fatal(_("-shared and -pie are incompatible"));
 
   if (this->shared() && this->relocatable())
     gold_fatal(_("-shared and -r are incompatible"));
+  if (this->pie() && this->relocatable())
+    gold_fatal(_("-pie and -r are incompatible"));
 
   // TODO: implement support for -retain-symbols-file with -r, if needed.
   if (this->relocatable() && this->retain_symbols_file())
     gold_fatal(_("-retain-symbols-file does not yet work with -r"));
 
   if (this->oformat_enum() != General_options::OBJECT_FORMAT_ELF
-      && (this->shared() || this->relocatable()))
-    gold_fatal(_("binary output format not compatible with -shared or -r"));
+      && (this->shared()
+         || this->pie()
+         || this->relocatable()))
+    gold_fatal(_("binary output format not compatible "
+                "with -shared or -pie or -r"));
 
   if (this->user_set_hash_bucket_empty_fraction()
       && (this->hash_bucket_empty_fraction() < 0.0
index 1a034423a72af36ff810d0893f08e96647de7cb8..cbb45b52179abd68f583fe59d2fef4d87b2d84f3 100644 (file)
@@ -763,6 +763,12 @@ class General_options
   DEFINE_string(oformat, options::EXACTLY_TWO_DASHES, '\0', "elf",
                N_("Set output format"), N_("[binary]"));
 
+  DEFINE_bool(pie, options::ONE_DASH, '\0', false,
+             N_("Create a position independent executable"), NULL);
+  DEFINE_bool_alias(pic_executable, pie, options::TWO_DASHES, '\0',
+                   N_("Create a position independent executable"), NULL,
+                   false);
+
 #ifdef ENABLE_PLUGINS
   DEFINE_special(plugin, options::TWO_DASHES, '\0',
                  N_("Load a plugin library"), N_("PLUGIN"));
@@ -1009,7 +1015,7 @@ class General_options
   // the output is position-independent or not.
   bool
   output_is_position_independent() const
-  { return this->shared(); }
+  { return this->shared() || this->pie(); }
 
   // Return true if the output is something that can be exec()ed, such
   // as a static executable, or a position-dependent or
@@ -1017,13 +1023,7 @@ class General_options
   // object file.
   bool
   output_is_executable() const
-  { return !this->shared() || this->output_is_pie(); }
-
-  // Return true if the output is a position-independent executable.
-  // This is currently not supported.
-  bool
-  output_is_pie() const
-  { return false; }
+  { return !this->shared() && !this->relocatable(); }
 
   // This would normally be static(), and defined automatically, but
   // since static is a keyword, we need to come up with our own name.
index 7d869b3326e0d6a0359b1cf978fe91d8a1bfc989..ae7b7b8686fe23b2c7c7c7f7f6bed8089adb9051 100644 (file)
@@ -442,7 +442,7 @@ Output_file_header::do_sized_write(Output_file* of)
   elfcpp::ET e_type;
   if (parameters->options().relocatable())
     e_type = elfcpp::ET_REL;
-  else if (parameters->options().shared())
+  else if (parameters->options().output_is_position_independent())
     e_type = elfcpp::ET_DYN;
   else
     e_type = elfcpp::ET_EXEC;
index 6d5038fb2c61b09114f1325ae892a978df69bb24..5dbab35b73b4c79509102576456bc08ac822bd22 100644 (file)
@@ -394,7 +394,8 @@ Symbol::final_value_is_known() const
 {
   // If we are not generating an executable, then no final values are
   // known, since they will change at runtime.
-  if (parameters->options().shared() || parameters->options().relocatable())
+  if (parameters->options().output_is_position_independent()
+      || parameters->options().relocatable())
     return false;
 
   // If the symbol is not from an object file, and is not undefined,
index d186cc17bb5f2e0be4f22701ca168be8467af97d..d1cd64761ccabc389a1f39e93fab7e3c840d603f 100644 (file)
@@ -533,7 +533,7 @@ class Symbol
   // Return true if this symbol is a function that needs a PLT entry.
   // If the symbol is defined in a dynamic object or if it is subject
   // to pre-emption, we need to make a PLT entry. If we're doing a
-  // static link, we don't create PLT entries.
+  // static link or a -pie link, we don't create PLT entries.
   bool
   needs_plt_entry() const
   {
@@ -542,6 +542,7 @@ class Symbol
       return false;
 
     return (!parameters->doing_static_link()
+           && !parameters->options().pie()
             && this->type() == elfcpp::STT_FUNC
             && (this->is_from_dynobj()
                 || this->is_undefined()
index e5cb0591bbb7d9e74d1d768a5d4ab015f8e18ed0..09d7325cb3df1aa302ba16f0798e71a491c64aa4 100644 (file)
@@ -176,6 +176,11 @@ basic_pic_test: basic_pic_test.o gcctestdir/ld
 basic_static_pic_test: basic_pic_test.o gcctestdir/ld
        $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
 
+check_PROGRAMS += basic_pie_test
+basic_pie_test.o: basic_test.cc
+       $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
+basic_pie_test: basic_pie_test.o gcctestdir/ld
+       $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
 
 check_PROGRAMS += constructor_test
 check_PROGRAMS += constructor_static_test
@@ -281,6 +286,19 @@ two_file_relocatable_test_LDADD = two_file_relocatable.o
 two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
        gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
 
+check_PROGRAMS += two_file_pie_test
+two_file_test_1_pie.o: two_file_test_1.cc
+       $(CXXCOMPILE) -c -fpie -o $@ $<
+two_file_test_1b_pie.o: two_file_test_1b.cc
+       $(CXXCOMPILE) -c -fpie -o $@ $<
+two_file_test_2_pie.o: two_file_test_2.cc
+       $(CXXCOMPILE) -c -fpie -o $@ $<
+two_file_test_main_pie.o: two_file_test_main.cc
+       $(CXXCOMPILE) -c -fpie -o $@ $<
+two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
+               two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
+       $(CXXLINK) -Bgcctestdir/ -pie two_file_test_1_pie.o two_file_test_1b_pie.o two_file_test_2_pie.o two_file_test_main_pie.o
+
 check_SCRIPTS += two_file_shared.sh
 check_DATA += two_file_shared.dbg
 MOSTLYCLEANFILES += two_file_shared.dbg
index 14c2cad1eb7d5cea031b66391e345f120ad445fc..3f5459f707a4dd327fd5e8dd6583ec882ea2a66c 100644 (file)
@@ -102,7 +102,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_4 = basic_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_test basic_pic_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_pic_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pie_test constructor_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_static_test \
@@ -114,7 +114,8 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_test \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_relocatable_test
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_relocatable_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_pie_test
 @GCC_FALSE@constructor_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
 @GCC_FALSE@    ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
 @GCC_FALSE@    $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
@@ -433,6 +434,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pic_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_static_pic_test$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ basic_pie_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_static_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test$(EXEEXT) \
@@ -445,7 +447,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_12_test$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_separate_shared_21_test$(EXEEXT) \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_relocatable_test$(EXEEXT)
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_relocatable_test$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_pie_test$(EXEEXT)
 @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_2 = two_file_shared_1_nonpic_test$(EXEEXT) \
 @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_shared_2_nonpic_test$(EXEEXT) \
 @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_nonpic_test$(EXEEXT) \
@@ -524,6 +527,12 @@ am__DEPENDENCIES_1 =
 basic_pic_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
        ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
        $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+basic_pie_test_SOURCES = basic_pie_test.c
+basic_pie_test_OBJECTS = basic_pie_test.$(OBJEXT)
+basic_pie_test_LDADD = $(LDADD)
+basic_pie_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
+       ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 basic_static_pic_test_SOURCES = basic_static_pic_test.c
 basic_static_pic_test_OBJECTS = basic_static_pic_test.$(OBJEXT)
 basic_static_pic_test_LDADD = $(LDADD)
@@ -920,6 +929,12 @@ am__two_file_pic_test_SOURCES_DIST = two_file_test_main.cc
 two_file_pic_test_OBJECTS = $(am_two_file_pic_test_OBJECTS)
 two_file_pic_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
        $(two_file_pic_test_LDFLAGS) $(LDFLAGS) -o $@
+two_file_pie_test_SOURCES = two_file_pie_test.c
+two_file_pie_test_OBJECTS = two_file_pie_test.$(OBJEXT)
+two_file_pie_test_LDADD = $(LDADD)
+two_file_pie_test_DEPENDENCIES = libgoldtest.a ../libgold.a \
+       ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
+       $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am__two_file_relocatable_test_SOURCES_DIST = two_file_test_main.cc
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am_two_file_relocatable_test_OBJECTS =  \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT)
@@ -1148,7 +1163,7 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 CXXLD = $(CXX)
 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
        -o $@
-SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
+SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
        basic_static_pic_test.c basic_static_test.c basic_test.c \
        $(binary_test_SOURCES) $(binary_unittest_SOURCES) \
        $(common_test_1_SOURCES) $(constructor_static_test_SOURCES) \
@@ -1180,7 +1195,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
        $(tls_static_pic_test_SOURCES) $(tls_static_test_SOURCES) \
        $(tls_test_SOURCES) $(two_file_mixed_2_shared_test_SOURCES) \
        $(two_file_mixed_shared_test_SOURCES) \
-       $(two_file_pic_test_SOURCES) \
+       $(two_file_pic_test_SOURCES) two_file_pie_test.c \
        $(two_file_relocatable_test_SOURCES) \
        $(two_file_same_shared_nonpic_test_SOURCES) \
        $(two_file_same_shared_strip_test_SOURCES) \
@@ -1203,9 +1218,9 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
        $(weak_test_SOURCES) $(weak_undef_nonpic_test_SOURCES) \
        $(weak_undef_test_SOURCES)
 DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
-       basic_static_pic_test.c basic_static_test.c basic_test.c \
-       $(am__binary_test_SOURCES_DIST) $(binary_unittest_SOURCES) \
-       $(am__common_test_1_SOURCES_DIST) \
+       basic_pie_test.c basic_static_pic_test.c basic_static_test.c \
+       basic_test.c $(am__binary_test_SOURCES_DIST) \
+       $(binary_unittest_SOURCES) $(am__common_test_1_SOURCES_DIST) \
        $(am__constructor_static_test_SOURCES_DIST) \
        $(am__constructor_test_SOURCES_DIST) \
        $(am__copy_test_SOURCES_DIST) \
@@ -1246,7 +1261,7 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
        $(am__tls_test_SOURCES_DIST) \
        $(am__two_file_mixed_2_shared_test_SOURCES_DIST) \
        $(am__two_file_mixed_shared_test_SOURCES_DIST) \
-       $(am__two_file_pic_test_SOURCES_DIST) \
+       $(am__two_file_pic_test_SOURCES_DIST) two_file_pie_test.c \
        $(am__two_file_relocatable_test_SOURCES_DIST) \
        $(am__two_file_same_shared_nonpic_test_SOURCES_DIST) \
        $(am__two_file_same_shared_strip_test_SOURCES_DIST) \
@@ -1845,6 +1860,12 @@ clean-checkPROGRAMS:
 @NATIVE_LINKER_FALSE@basic_pic_test$(EXEEXT): $(basic_pic_test_OBJECTS) $(basic_pic_test_DEPENDENCIES) 
 @NATIVE_LINKER_FALSE@  @rm -f basic_pic_test$(EXEEXT)
 @NATIVE_LINKER_FALSE@  $(LINK) $(basic_pic_test_OBJECTS) $(basic_pic_test_LDADD) $(LIBS)
+@GCC_FALSE@basic_pie_test$(EXEEXT): $(basic_pie_test_OBJECTS) $(basic_pie_test_DEPENDENCIES) 
+@GCC_FALSE@    @rm -f basic_pie_test$(EXEEXT)
+@GCC_FALSE@    $(LINK) $(basic_pie_test_OBJECTS) $(basic_pie_test_LDADD) $(LIBS)
+@NATIVE_LINKER_FALSE@basic_pie_test$(EXEEXT): $(basic_pie_test_OBJECTS) $(basic_pie_test_DEPENDENCIES) 
+@NATIVE_LINKER_FALSE@  @rm -f basic_pie_test$(EXEEXT)
+@NATIVE_LINKER_FALSE@  $(LINK) $(basic_pie_test_OBJECTS) $(basic_pie_test_LDADD) $(LIBS)
 @GCC_FALSE@basic_static_pic_test$(EXEEXT): $(basic_static_pic_test_OBJECTS) $(basic_static_pic_test_DEPENDENCIES) 
 @GCC_FALSE@    @rm -f basic_static_pic_test$(EXEEXT)
 @GCC_FALSE@    $(LINK) $(basic_static_pic_test_OBJECTS) $(basic_static_pic_test_LDADD) $(LIBS)
@@ -2073,6 +2094,12 @@ two_file_mixed_shared_test$(EXEEXT): $(two_file_mixed_shared_test_OBJECTS) $(two
 two_file_pic_test$(EXEEXT): $(two_file_pic_test_OBJECTS) $(two_file_pic_test_DEPENDENCIES) 
        @rm -f two_file_pic_test$(EXEEXT)
        $(two_file_pic_test_LINK) $(two_file_pic_test_OBJECTS) $(two_file_pic_test_LDADD) $(LIBS)
+@GCC_FALSE@two_file_pie_test$(EXEEXT): $(two_file_pie_test_OBJECTS) $(two_file_pie_test_DEPENDENCIES) 
+@GCC_FALSE@    @rm -f two_file_pie_test$(EXEEXT)
+@GCC_FALSE@    $(LINK) $(two_file_pie_test_OBJECTS) $(two_file_pie_test_LDADD) $(LIBS)
+@NATIVE_LINKER_FALSE@two_file_pie_test$(EXEEXT): $(two_file_pie_test_OBJECTS) $(two_file_pie_test_DEPENDENCIES) 
+@NATIVE_LINKER_FALSE@  @rm -f two_file_pie_test$(EXEEXT)
+@NATIVE_LINKER_FALSE@  $(LINK) $(two_file_pie_test_OBJECTS) $(two_file_pie_test_LDADD) $(LIBS)
 two_file_relocatable_test$(EXEEXT): $(two_file_relocatable_test_OBJECTS) $(two_file_relocatable_test_DEPENDENCIES) 
        @rm -f two_file_relocatable_test$(EXEEXT)
        $(two_file_relocatable_test_LINK) $(two_file_relocatable_test_OBJECTS) $(two_file_relocatable_test_LDADD) $(LIBS)
@@ -2171,6 +2198,7 @@ distclean-compile:
        -rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_pic_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_pie_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_static_pic_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_static_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basic_test.Po@am__quote@
@@ -2217,6 +2245,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test_file2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tls_test_main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_pie_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_strip_test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_1.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_1b.Po@am__quote@
@@ -2637,6 +2666,10 @@ uninstall-am:
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
 @GCC_TRUE@@NATIVE_LINKER_TRUE@basic_static_pic_test: basic_pic_test.o gcctestdir/ld
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@basic_pie_test.o: basic_test.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@basic_pie_test: basic_pie_test.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
 @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_1_pic.o: two_file_test_1.cc
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
 @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_1b_pic.o: two_file_test_1b.cc
@@ -2651,6 +2684,17 @@ uninstall-am:
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
 @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_1_pie.o: two_file_test_1.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpie -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_1b_pie.o: two_file_test_1b.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpie -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_2_pie.o: two_file_test_2.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpie -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_test_main_pie.o: two_file_test_main.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpie -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@         two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -pie two_file_test_1_pie.o two_file_test_1b_pie.o two_file_test_2_pie.o two_file_test_main_pie.o
 @GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared.dbg: two_file_shared.so
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -w $< >$@ 2>/dev/null
 @FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld