Set flag_pic to flag_pie for PIE in LTO
authorH.J. Lu <hongjiu.lu@intel.com>
Thu, 17 Mar 2016 11:07:10 +0000 (11:07 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Thu, 17 Mar 2016 11:07:10 +0000 (04:07 -0700)
Since PIE implies PIC, we should set flag_pic to flag_pie for PIE in
LTO.

PR lto/70258
* lto-lang.c (lto_post_options): Set flag_pic to flag_pie for
PIE.

From-SVN: r234284

gcc/lto/ChangeLog
gcc/lto/lto-lang.c

index 7a298d6edf055ee8712db08145cc1b9a19eb9393..dbb69a2e076cf1b6712e9b3fef93254d89886ebd 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR lto/70258
+       * lto-lang.c (lto_post_options): Set flag_pic to flag_pie for
+       PIE.
+
 2016-03-08  Jakub Jelinek  <jakub@redhat.com>
 
        * lto-symtab.h (lto_symtab_prevail_decl): Fix spelling
index 691e9e2090521a3a1d7ff0ec750cb85d4c673fd5..b5efe3aab7e1f50a63b4419ff4b4520d2eae9c4a 100644 (file)
@@ -836,7 +836,7 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
       /* If -fPIC or -fPIE was used at compile time, be sure that
          flag_pie is 2.  */
       flag_pie = MAX (flag_pie, flag_pic);
-      flag_pic = 0;
+      flag_pic = flag_pie;
       break;
 
     case LTO_LINKER_OUTPUT_EXEC: /* Normal executable */