Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"abhay@linux.ibm.com" <abhay@linux.ibm.com>
Cc: Abhay Kandpal <Abhay.k@ibm.com>, "cel@linux.ibm.com" <cel@linux.ibm.com>
Subject: Re: [PATCHi v1] PowerPC: Create call stubs for compiled modules
Date: Tue, 18 Aug 2026 12:19:54 +0000	[thread overview]
Message-ID: <1a31198de71abfc8f36c893cc97c81b72c6112a7.camel@de.ibm.com> (raw)
In-Reply-To: <20260813092829.262470-1-abhay@linux.ibm.com>

Abhay Kandpal <abhay@linux.ibm.com> wrote:

>The compile command loads a module into inferior memory and relocates
>it itself, without a linker.  For R_PPC64_REL24 it patches the branch
>to point directly at the target.  On ELFv2 that is not a valid call to
>another module: the callee derives its TOC pointer from r12, which
only
>a PLT-style call stub sets up, and the caller's TOC pointer is never
>restored because the nop following the bl is left alone.

On other platforms, the way this is supposed to work is to use a
set of compiler command-line options that result in code that does
not require PLTs for external calls.  Typically, this means to use
-mcmodel=large.

However, it seems that on PowerPC, while that option exists, it
generates code that still needs PLTs.  There is another option
-mlongcall that should avoid this, however.

I'm wondering if we were to just add -mlongcall to the platform-
specific compiler options for PowerPC, we could fix this issue
without having to reimplement a full PLT solution in GDB ...

Bye,
Ulrich

  reply	other threads:[~2026-08-18 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  9:28 Abhay Kandpal
2026-08-18 12:19 ` Ulrich Weigand [this message]
2026-08-18 17:47   ` Abhay Kandpal
2026-08-19 12:39     ` Ulrich Weigand
2026-08-19 18:39       ` Abhay Kandpal

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=1a31198de71abfc8f36c893cc97c81b72c6112a7.camel@de.ibm.com \
    --to=ulrich.weigand@de.ibm.com \
    --cc=Abhay.k@ibm.com \
    --cc=abhay@linux.ibm.com \
    --cc=cel@linux.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /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