public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Ben Coyote Woodard <woodard@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Fix runtime linker auditing on aarch64
Date: Wed, 23 Sep 2020 17:19:27 +0100	[thread overview]
Message-ID: <20200923161927.GH16385@arm.com> (raw)
In-Reply-To: <X4A4HQ.1CQGG0D4I4DC3@redhat.com>

The 09/23/2020 08:10, Ben Coyote Woodard wrote:
> On Wed, Sep 23, 2020 at 13:34, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> > The 09/22/2020 18:16, Ben Woodard via Libc-alpha wrote:
> > >   /* Return values for calls from PLT on AArch64.  */
> > >   typedef struct La_aarch64_retval
> > >   {
> > >  -  /* Up to two integer registers can be used for a return value.
> > > */
> > >  -  uint64_t lrv_xreg[2];
> > >  -  /* Up to four D registers can be used for a return value.  */
> > >  -  uint64_t lrv_dreg[4];
> > >  +  /* Up to eight integer registers and the indirect result
> > > location register
> > >  +     can be used for a return value.  */
> > >  +  uint64_t    lrv_xreg[9];
> > 
> > x8 is not preserved so recording it at function exit
> > is not useful. (on entry it points to where results
> > are stored but on exit it can be clobbered)
> 
> OK that was not clear to me reading the AAPCS. Do you want to ping you're
> colleagues the tech writers over at arm and see if they can tighten up the
> language a bit.

aapcs is now openly developed (on github)
so you can submit bug reports easily ;)

in this case section 6.1.1 does not say
if x8 is preserved or not, but 6.5 is quite
explicit i think:

https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst#result-return

> > >  +  /* Up to eight V registers can be used for a return value.  */
> > >  +  __uint128_t lrv_vreg[8];
> > > 
> > >   } La_aarch64_retval;
> > >   __BEGIN_DECLS
> > 
> > note: i don't like to use non-standard types in
> > public apis (like __uint128_t), but we already
> > made this mistake in the linux sigcontext, so this
> > is probably ok.
> > 
> > (my preference normally is to use a standard type
> > e.g. long double or char[] with alignment attr,
> > but in practice __uint128_t is probably easier to
> > deal with)
> > 
> 
> I kind of prefer "long double" here as well. It is after all what it likely
> is. I'm not really attached to __uint128_t; the previous version of the
> interface had uint64_t and so when making the registers the correct size I
> changed it to uint128_t but that didn't compile and then when I grepped the
> source I found __uint128_t. It wasn't like I put a lot of thought into that
> decision.

hm, i think the common case is to inspect float
or double arguments in the v regs, so the
__uint128_t is probably easier for the user
to deal with. (and sigcontext etc already
uses that for save/restore of the registers
so it is better for interop and least surprise)

it's unfortunate that there is no standard
uint128_t type. (i think the arm way would
be to use "uint8x16_t" or similar type from
arm_neon.h but in practice that's harder
to use)

so keep this as is.

(but this reminds me that the current hooks
are broken for long double functions, not
just for functions taking neon vector args)


  reply	other threads:[~2020-09-23 16:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23  1:16 Ben Woodard
2020-09-23 12:22 ` Florian Weimer
2020-09-23 12:48   ` Szabolcs Nagy
2020-09-23 12:56     ` Florian Weimer
2020-09-23 13:18       ` Szabolcs Nagy
2020-09-24 11:10         ` Florian Weimer
2020-09-23 12:34 ` Szabolcs Nagy
2020-09-23 15:10   ` Ben Coyote Woodard
2020-09-23 16:19     ` Szabolcs Nagy [this message]
2020-09-23 18:12       ` Ben Coyote Woodard
2020-09-23 18:00   ` Ben Coyote Woodard
2020-09-24  0:30 ` Carlos O'Donell
2020-09-24  3:14   ` Ben Coyote Woodard
2020-09-24  8:04     ` Szabolcs Nagy
2020-09-24  9:58     ` Florian Weimer

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=20200923161927.GH16385@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=woodard@redhat.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).