On 05/10/2015 10:59 AM, Jan Hubicka wrote:
This patch introduces option -fno-plt that allows to expand calls that would
go via PLT to load the address of the function immediately at call site (which
introduces a GOT load).  Cover letter explains the motivation for this patch.

New option documentation for invoke.texi is missing from the patch; if this is
accepted I'll be happy to send a v2 with documentation added.

        * calls.c (prepare_call_address): Transform PLT call to GOT lookup and
        indirect call by forcing address into a pseudo with -fno-plt.
        * common.opt (flag_plt): New option.

diff --git a/gcc/common.opt b/gcc/common.opt
index b49ac46..cd8b256 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1773,12 +1773,16 @@ Common Report Var(flag_pic,1) Negative(fpie)
  Generate position-independent code if possible (small mode)

  fpie
  Common Report Var(flag_pie,1) Negative(fPIC)
  Generate position-independent code for executables if possible (small mode)

+fplt
+Common Report Var(flag_plt) Init(1)
+Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
+

This won't play well with LTO since fplt will become another global flag while
it affects codegen.
I know Richi explained this to me in the past, but I can't remember the details of why this is bad. Can you walk me through it again?

jeff

Reply via email to