Message ID | CAAs8HmxvUrU9Z5CLHQmCRDsN-CHmT3FEBVC8wtgMvcdv8Z17+A@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Thu, May 22, 2014 at 4:36 PM, Sriraman Tallam <tmsriram@google.com> wrote: > This patch is pending review for trunk. Please see if this is ok to > commit to google/gcc-4_8 branch. Please see this for more details: > > https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01215.html +mld-pie-copyrelocs +Target Report Var(ix86_ld_pie_copyrelocs) Init(0) +Use linker copy relocs for pie They are not "linker copy relocs", they are simply "copy relocations". So I would call the option "-mcopy-relocs" and be done with that. But this is just bike-shedding :-) LGTM.
Also missing documentation in invoke.texi? Other than that, ok. David On Thu, May 22, 2014 at 5:00 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote: > On Thu, May 22, 2014 at 4:36 PM, Sriraman Tallam <tmsriram@google.com> wrote: >> This patch is pending review for trunk. Please see if this is ok to >> commit to google/gcc-4_8 branch. Please see this for more details: >> >> https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01215.html > > +mld-pie-copyrelocs > +Target Report Var(ix86_ld_pie_copyrelocs) Init(0) > +Use linker copy relocs for pie > > They are not "linker copy relocs", they are simply "copy relocations". > > So I would call the option "-mcopy-relocs" and be done with that. But this > is just bike-shedding :-) > > LGTM. > -- > Paul Pluzhnikov
On Thu, May 22, 2014 at 5:04 PM, Xinliang David Li <davidxl@google.com> wrote: > Also missing documentation in invoke.texi? Other than that, ok. I have made the changes and committed my patch. Sri > > David > > On Thu, May 22, 2014 at 5:00 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote: >> On Thu, May 22, 2014 at 4:36 PM, Sriraman Tallam <tmsriram@google.com> wrote: >>> This patch is pending review for trunk. Please see if this is ok to >>> commit to google/gcc-4_8 branch. Please see this for more details: >>> >>> https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01215.html >> >> +mld-pie-copyrelocs >> +Target Report Var(ix86_ld_pie_copyrelocs) Init(0) >> +Use linker copy relocs for pie >> >> They are not "linker copy relocs", they are simply "copy relocations". >> >> So I would call the option "-mcopy-relocs" and be done with that. But this >> is just bike-shedding :-) >> >> LGTM. >> -- >> Paul Pluzhnikov
Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 210728) +++ config/i386/i386.c (working copy) @@ -12540,7 +12540,10 @@ legitimate_pic_address_disp_p (rtx disp) /* TLS references should always be enclosed in UNSPEC. */ if (SYMBOL_REF_TLS_MODEL (op0)) return false; - if (!SYMBOL_REF_FAR_ADDR_P (op0) && SYMBOL_REF_LOCAL_P (op0) + if (!SYMBOL_REF_FAR_ADDR_P (op0) + && (SYMBOL_REF_LOCAL_P (op0) + || (TARGET_64BIT && ix86_ld_pie_copyrelocs && flag_pie + && !SYMBOL_REF_FUNCTION_P (op0))) && ix86_cmodel != CM_LARGE_PIC) return true; break; Index: config/i386/i386.opt =================================================================== --- config/i386/i386.opt (revision 210728) +++ config/i386/i386.opt (working copy) @@ -198,6 +198,10 @@ mfancy-math-387 Target RejectNegative Report InverseMask(NO_FANCY_MATH_387, USE_FANCY_MATH_387) Save Generate sin, cos, sqrt for FPU +mld-pie-copyrelocs +Target Report Var(ix86_ld_pie_copyrelocs) Init(0) +Use linker copy relocs for pie + mforce-drap Target Report Var(ix86_force_drap) Always use Dynamic Realigned Argument Pointer (DRAP) to realign stack Index: testsuite/gcc.target/i386/ld-pie-copyrelocs-1.c =================================================================== --- testsuite/gcc.target/i386/ld-pie-copyrelocs-1.c (revision 0) +++ testsuite/gcc.target/i386/ld-pie-copyrelocs-1.c (revision 0) @@ -0,0 +1,13 @@ +/* Test if -mld-pie-copyrelocs does the right thing. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpie -mld-pie-copyrelocs" } */ + +extern int glob_a; + +int foo () +{ + return glob_a; +} + +/* glob_a should never be accessed with a GOTPCREL */ +/* { dg-final { scan-assembler-not "glob_a\\@GOTPCREL" { target { x86_64-*-* } } } } */ Index: testsuite/gcc.target/i386/ld-pie-copyrelocs-2.c =================================================================== --- testsuite/gcc.target/i386/ld-pie-copyrelocs-2.c (revision 0) +++ testsuite/gcc.target/i386/ld-pie-copyrelocs-2.c (revision 0) @@ -0,0 +1,13 @@ +/* Test if -mno-ld-pie-copyrelocs does the right thing. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpie -mno-ld-pie-copyrelocs" } */ + +extern int glob_a; + +int foo () +{ + return glob_a; +} + +/* glob_a should always be accessed via GOT */ +/* { dg-final { scan-assembler "glob_a\\@GOT" { target { x86_64-*-* } } } } */