public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: Making a syscall before ld.so self-relocation on MIPS
Date: Wed, 17 May 2023 19:41:12 +0000	[thread overview]
Message-ID: <5865c192-215e-bd3b-dbd2-40234230c1c8@codesourcery.com> (raw)
In-Reply-To: <87jzx6hi27.fsf@oldenburg3.str.redhat.com>

On Wed, 17 May 2023, Florian Weimer via Libc-alpha wrote:

> * Joseph Myers:
> 
> > On Wed, 17 May 2023, Florian Weimer via Libc-alpha wrote:
> >
> >> I'm reviewing HIDDEN_VAR_NEEDS_DYNAMIC_RELOC if they support inline
> >> system calls (without function calls), so that I can make a system call
> >> (mmap actually) before initial self-relocation of the dynamic loader.
> >> 
> >> So far, it looks good in theory, except on MIPS.  First there is MIPS16:
> >> 
> >> /* There's no MIPS16 syscall instruction, so we go through out-of-line
> >>    standard MIPS wrappers.  These do use inline snippets below though,
> >>    through INTERNAL_SYSCALL_MIPS16.  Spilling the syscall number to
> >>    memory gives the best code in that case, avoiding the need to save
> >>    and restore a static register.  */
> >> 
> >> Is MIPS16 the default in GCC?  We don't build for explicitly in
> >> scripts/build-many-glibcs.py.
> >
> > No, it's not the default; you need to use the -mips16 option.
> 
> And apparently this is expected to work for building glibc?  We have
> some support code for it.

Yes, it's supposed to work for building glibc (without actually being a 
different ABI).  I haven't tested it for several years.

> I guess I could override that for elf/rtld.c with -mno-mips16.  Would it
> be okay to do that, and rely on GCC generating a direct bal instruction
> for invoking the system call helper?

I think using -mno-mips16 for elf/rtld.c is OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

      reply	other threads:[~2023-05-17 19:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17  9:29 Florian Weimer
2023-05-17 19:01 ` Joseph Myers
2023-05-17 19:30   ` Florian Weimer
2023-05-17 19:41     ` Joseph Myers [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=5865c192-215e-bd3b-dbd2-40234230c1c8@codesourcery.com \
    --to=joseph@codesourcery.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).