public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] leverage linker relaxation on ppc vxworks RTPs
@ 2018-10-11 18:22 Olivier Hainque
  0 siblings, 0 replies; only message in thread
From: Olivier Hainque @ 2018-10-11 18:22 UTC (permalink / raw)
  To: GCC Patches; +Cc: Olivier Hainque, Douglas B Rupp

[-- Attachment #1: Type: text/plain, Size: 894 bytes --]

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  <rupp@adacore.com>
            Olivier Hainque  <hainque@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.


[-- Attachment #2: relax-ppc-rtp.txt --]
[-- Type: text/plain, Size: 686 bytes --]

--- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-11 18:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-11 18:22 [patch] leverage linker relaxation on ppc vxworks RTPs Olivier Hainque

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).