public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Olivier Hainque <hainque@adacore.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Olivier Hainque <hainque@adacore.com>, Douglas B Rupp <rupp@adacore.com>
Subject: [patch] leverage linker relaxation on ppc vxworks RTPs
Date: Thu, 11 Oct 2018 18:22:00 -0000	[thread overview]
Message-ID: <B04D2B62-AF2A-446B-9FC0-E4E32E8E5E3F@adacore.com> (raw)

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

                 reply	other threads:[~2018-10-11 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B04D2B62-AF2A-446B-9FC0-E4E32E8E5E3F@adacore.com \
    --to=hainque@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rupp@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).