From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: build with clang-3.4 warnings report
Date: Sat, 5 Apr 2014 12:35:12 -0400 [thread overview]
Message-ID: <20140405163512.GW26358@brightrain.aerifal.cx> (raw)
In-Reply-To: <1396708669.11744.314.camel@eris.loria.fr>
On Sat, Apr 05, 2014 at 04:37:49PM +0200, Jens Gustedt wrote:
> Am Samstag, den 05.04.2014, 09:07 -0400 schrieb Rich Felker:
> > On Sat, Apr 05, 2014 at 11:04:58AM +0200, Jens Gustedt wrote:
> > > The whole thing could be avoided by using designated initializers and
> > > eliminating the whole errid array right away. Designated initializers
> > > should be present in all decent versions of gcc. Do you want me to
> > > prepare a patch?
> >
> > No, this is not about avoiding features but rather not adding a whole
> > page (or two pages, on 64-bit machines) of non-sharable pseudo-data to
> > libc.so, or the same amount of text to nearly every static-linked
> > program.
>
> I experimented a bit, and I get
>
> - +20 bytes more for the simplest version, replacing the positon
> array by an array with sizes of the strings and a good reduction in
> complexity of the function
>
> - +40 to +60 bytes extra code size for some trivial error and bounds
> checking (which only can do good, here)
The current code already has full bounds/error checking. Any value
except a valid error code will result in "No error information".
> - +100 bytes when replacing the "unsigned char" array with the sizes
> by an "unsigned short" array that holds all the offsets of the
> strings and reduces the function itself mainly to a table lookup.
>
> (all that on x86_64 and only compile tested for them moment)
I'd be interested in seeing what you mean by some of these, but note
that these are all +'s and don't seem to have any concrete advantages
over the current code.
> So this is largely below the one page threshold (increasing code size
> from 3200 byte to 3360 at the worst), and the generated assembler
> looks quite clean.
I was talking about the approach with designated initializers, which I
assumed would look something like:
{
[EBADF] = "Bad file descriptor",
[EILSEQ] = "Illegal sequence",
...
}
Rich
next prev parent reply other threads:[~2014-04-05 16:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-04 19:59 Abdoulaye Walsimou Gaye
2014-04-04 20:47 ` Rich Felker
2014-04-05 1:06 ` Abdoulaye Walsimou Gaye
2014-04-05 1:54 ` Rich Felker
2014-04-05 9:04 ` Jens Gustedt
2014-04-05 9:31 ` Szabolcs Nagy
2014-04-05 13:07 ` Rich Felker
2014-04-05 14:37 ` Jens Gustedt
2014-04-05 16:35 ` Rich Felker [this message]
2014-04-05 22:08 ` Jens Gustedt
2014-04-06 1:57 ` Rich Felker
2014-04-06 16:37 ` Jens Gustedt
2014-04-06 16:49 ` Rich Felker
2014-04-07 11:17 ` Oliver Schneider
2014-04-07 17:23 ` Rich Felker
2014-04-07 19:40 ` Abdoulaye Walsimou Gaye
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=20140405163512.GW26358@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).