gcc: add some size optimization patches
[openwrt.git] / toolchain / gcc / patches / 4.9-linaro / 020-no-plt-backport.patch
1 --- a/gcc/calls.c
2 +++ b/gcc/calls.c
3 @@ -184,6 +184,12 @@ prepare_call_address (tree fndecl, rtx f
4                && targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
5               ? force_not_mem (memory_address (FUNCTION_MODE, funexp))
6               : memory_address (FUNCTION_MODE, funexp));
7 +  else if (flag_pic && !flag_plt && fndecl
8 +          && TREE_CODE (fndecl) == FUNCTION_DECL
9 +          && !targetm.binds_local_p (fndecl))
10 +    {
11 +      funexp = force_reg (Pmode, funexp);
12 +    }
13    else if (! sibcallp)
14      {
15  #ifndef NO_FUNCTION_CSE
16 --- a/gcc/common.opt
17 +++ b/gcc/common.opt
18 @@ -1659,6 +1659,10 @@ fpie
19  Common Report Var(flag_pie,1) Negative(fPIC)
20  Generate position-independent code for executables if possible (small mode)
21  
22 +fplt
23 +Common Report Var(flag_plt) Init(1)
24 +Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
25 +
26  fplugin=
27  Common Joined RejectNegative Var(common_deferred_options) Defer
28  Specify a plugin to load