020-no-plt-backport.patch 966 B

12345678910111213141516171819202122232425262728
  1. --- a/gcc/calls.c
  2. +++ b/gcc/calls.c
  3. @@ -225,6 +225,12 @@ prepare_call_address (tree fndecl_or_typ
  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_or_type
  8. + && TREE_CODE (fndecl_or_type) == FUNCTION_DECL
  9. + && !targetm.binds_local_p (fndecl_or_type))
  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. @@ -1779,6 +1779,10 @@ fpie
  19. Common Report Var(flag_pie,1) Negative(fPIC)
  20. Generate position-independent code for executables if possible (small mode)
  21. +fplt
  22. +Common Report Var(flag_plt) Init(1)
  23. +Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
  24. +
  25. fplugin=
  26. Common Joined RejectNegative Var(common_deferred_options) Defer
  27. Specify a plugin to load