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) - +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) 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. Jens -- :: INRIA Nancy Grand Est :: http://www.loria.fr/~gustedt/ :: :: AlGorille ::::::::::::::: office Nancy : +33 383593090 :: :: ICube :::::::::::::: office Strasbourg : +33 368854536 :: :: ::::::::::::::::::::::::::: gsm France : +33 651400183 :: :: :::::::::::::::::::: gsm international : +49 15737185122 ::