public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: YunQiang Su <syq@gcc.gnu.org>
Cc: Nick Clifton <nickc@redhat.com>,
	binutils@sourceware.org,  xry111@xry111.site
Subject: Re: [PATCH v4] MIPS/Gas: Disallow branch to absolute address for PIC
Date: Tue, 6 Feb 2024 19:20:14 +0000 (GMT)	[thread overview]
Message-ID: <alpine.DEB.2.21.2402061910440.2376@angie.orcam.me.uk> (raw)
In-Reply-To: <20240206170538.2937169-1-syq@gcc.gnu.org>

On Wed, 7 Feb 2024, YunQiang Su wrote:

> The asm code like
> 	b	(0)
> will generate binary like:
> 
> 00000000 <.text>:
> 	0: 1000ffff b 0x0
>            0: R_MIPS_PC16 *ABS*
> 	4: 00000000 nop
> If this object is linked into an PIC/PIC dynamic executable,
> this branch instruction will jump to a wrong address, with low
> 16bit unset.

 NAK, `mips_pic' may be set to SVR4_PIC and still produce de facto non-PIC 
code, as per the original SVR4 MIPS ABI (with lazy binding stubs rather 
than PLT).  We continue supporting this mode.

 Originally NO_PIC was intended for bare metal code only, statically 
linked only, which was later extended to Linux, etc. with the addition of 
PLT and copy reloc support.

 PR31343 has to be sorted in the linker.

  Maciej

  reply	other threads:[~2024-02-06 19:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 17:05 YunQiang Su
2024-02-06 19:20 ` Maciej W. Rozycki [this message]
2024-02-07  4:37   ` YunQiang Su
2024-02-07 11:03     ` Maciej W. Rozycki

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=alpine.DEB.2.21.2402061910440.2376@angie.orcam.me.uk \
    --to=macro@orcam.me.uk \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=syq@gcc.gnu.org \
    --cc=xry111@xry111.site \
    /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).