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: [PATCH v2] PowerPC: fix external calls from modules built by the compile command
Date: Thu, 20 Aug 2026 11:03:46 +0000	[thread overview]
Message-ID: <f7b4e4567b2feabbb77af7971bb57848343a4419.camel@de.ibm.com> (raw)
In-Reply-To: <20260819183429.3039030-1-abhay@linux.ibm.com>

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

>A module built for the compile command is loaded into inferior memory
>without a linker, so it has no PLT.  On ELFv2 the default code model
>still emits a direct bl for a call to another module, leaving r12
unset
>and the caller's TOC pointer unrestored, and the callee then derives a
>wrong r2 from a stale r12.
>
>gdb.compile/compile-setjmp.exp shows this: the injected code calls
>setjmp, whose global entry point computes r2 from a stale r12, and the
>first TOC-relative load segfaults.
>
>-mlongcall makes the call indirect, but on its own it reaches the
target
>through a PLT entry, giving R_PPC64_PLT16_HA/LO_DS relocations that
BFD's
>generic linker rejects.  Adding -mno-pltseq resolves the call against
the
>module's own TOC instead, via R_PPC64_TOC16_HA/LO_DS, which GDB
already
>handles.  GCC then emits the r2 save and restore around the call
itself.

This is OK.

Thanks,
Ulrich

      reply	other threads:[~2026-08-20 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 18:34 Abhay Kandpal
2026-08-20 11:03 ` Ulrich Weigand [this message]

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=f7b4e4567b2feabbb77af7971bb57848343a4419.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