Hello, Most VxWorks programs refer to kernel services at some point, and these often end up too far away for short calls on powerpc.
This patch, originally contributed by Doug, arranges to request linker relaxation by default for RTPs. This helps many programs transparently, the feature has been available in binutils for a long time now and is more precise than -mlongcall at compile time. We have been using minor variants of this patch in-house successfully for at least couple of years now, I checked that this version has the intended effect on our gcc-8 based version of the toolchain and the patch applies untouched on mainline. Olivier 2018-10-10 Doug Rupp <r...@adacore.com> Olivier Hainque <hain...@adacore.com> * config/rs6000/vxworks.h (VXWORKS_RELAX_LINK_SPEC): New macro. Pass --relax to the linker for RTPs. (LINK_SPEC): Append VXWORKS_RELAX_LINK_SPEC.
--- a/gcc/config/rs6000/vxworks.h +++ b/gcc/config/rs6000/vxworks.h @@ -88,8 +88,15 @@ VXWORKS_ADDITIONAL_CPP_SPEC #undef LIB_SPEC #define LIB_SPEC VXWORKS_LIB_SPEC + +/* For RTPs, leverage linker relaxation. This helps programs referring + to, typically, kernel services too far away for short calls. This is more + precise than -mlongcall and can be overriden with -Wl,--no-relax. */ +#define VXWORKS_RELAX_LINK_SPEC "%{mrtp:--relax}" + #undef LINK_SPEC -#define LINK_SPEC VXWORKS_LINK_SPEC +#define LINK_SPEC VXWORKS_LINK_SPEC " " VXWORKS_RELAX_LINK_SPEC + #undef STARTFILE_SPEC #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC #undef ENDFILE_SPEC