020-no-plt-backport.patch 942 B

12345678910111213141516171819202122232425262728
  1. --- a/gcc/calls.c
  2. +++ b/gcc/calls.c
  3. @@ -176,6 +176,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. @@ -1617,6 +1617,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