Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190220192423.GD23599@brightrain.aerifal.cx>
Date: Wed, 20 Feb 2019 14:24:23 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Stdio resource usage

On Wed, Feb 20, 2019 at 08:11:51PM +0100, Markus Wichmann wrote:
> On Wed, Feb 20, 2019 at 12:34:49PM -0600, A. Wilcox wrote:
> > On 02/20/19 09:47, Markus Wichmann wrote:
> > > It appears as though at least gcc 8 is no longer as inline happy as it
> > > once was.
> > 
> > 
> > I have 0 experience with gcc8, but have you tried explicitly asking?
> > These CFLAGS look useful:
> > 
> > -finline-functions
> > -finline-functions-called-once
> > -finline-small-functions
> > 
> > Best to you and yours,
> > --arw
> > 
> > -- 
> > A. Wilcox (awilfox)
> > Project Lead, Adélie Linux
> > https://www.adelielinux.org
> > 
> 
> 
> For one, that doesn't count, since the whole purpose was to try to
> trigger the problem inadvertantly. For two, according to the manpage:
> 
> | -finline-small-functions
> |    [...]
> |    Enabled at level -O2.
> |
> |-finline-functions
> |    [...]
> |    Enabled at level -O3.
> |
> |-finline-functions-called-once
> |    [...]
> |    Enabled at levels -O1, -O2, -O3, and -Os.
> 
> I have no idea what the purpose of the enumeration in the last one is,
> since the levels are supposed to be cumulative, with -Os being on top of
> level 1. Anyway, it appears I inadvertantly *did* try all those
> switches.
> 
> Though I did get curious, and decided to check if my method even works.
> I'm running objdump on vfprintf.o, and check for the first stack
> allocation in the functions. And let the following be my validation:
> clang will inline fmt_fp into printf_core at levels -Os and -O3. And
> printf_core will allocate 8k of stack.

For what it's worth, gcc has a -fconserve-stack that in principle
should avoid this problem, but I could never get it to do anything. If
it works now we should probably detect and add it to default CFLAGS.

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.