Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 19 Jan 2020 12:38:04 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Minor style patch to exit.c

On Sun, Jan 19, 2020 at 08:32:57PM +0300, Alexander Monakov wrote:
> 
> 
> On Sun, 19 Jan 2020, Rich Felker wrote:
> 
> > > I would suggest
> > > 
> > >   void (**ptr)(void);
> > > 
> > >   __asm__ ("" : "=g"(ptr) : "0"(..._end), "X"(..._start));
> > > 
> > >   while (ptr != _start) (*--ptr)();
> > 
> > I think we could just put the assignment outside the asm and use "+g".
> > Not clear why _start is needed as an input operand. It's external so
> > asm must be assumed to be able to see it.
> 
> In the context of LTO asms really need to mention referenced symbols in
> constraints. Plus, it's good to have "the pointer is related to _start"
> spelled out in the code.

I think this is true for objects defined in C code, but not for ones
defined in external asm or by the linker, which are not subject to any
analysis by LTO. Both the contents of inline asm statements and the
contents of external asm are black boxes, no? I think if they're not
treated as such lots of reasonable things would break.

> > BTW does the "X" constraint work all the way back to ancient gcc (and
> > then presumably with pcc, clang)? The first time I ever saw it was in
> > one of your other patches.
> 
> gcc documentation says 2.95 already had it.

Thanks! I tried looking at 3.x docs but forgot how to construct the
URLs.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.