Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 5 Apr 2014 12:35:12 -0400
From: Rich Felker <>
Subject: Re: build with clang-3.4 warnings report

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
> >, 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",


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.