tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

reducing relocations in unvis(3) implementation



I'm about to commit NetBSD's implementation of the vis(3) and unvis(3)
APIs to FreeBSD.  When I asked for review Jilles Tjoelker commented:

> Please avoid adding 100 relative relocations, for example by changing
> const char *name to char name[7].
> 
> RTLD will have to adjust 100 pointers for the load address of libc.so.7,
> and even in a static library the pointers take up a disproportionate
> amount of space.

The following patch accomplishes this.

Thanks,
Brooks

Index: unvis.c
===================================================================
RCS file: /cvsroot/src/lib/libc/gen/unvis.c,v
retrieving revision 1.39
diff -u -r1.39 unvis.c
--- unvis.c     13 Mar 2012 21:13:37 -0000      1.39
+++ unvis.c     14 Dec 2012 17:00:36 -0000
@@ -81,7 +81,7 @@
  * RFC 1866
  */
 static const struct nv {
-       const char *name;
+       char name[7];
        uint8_t value;
 } nv[] = {
        { "AElig",      198 }, /* capital AE diphthong (ligature)  */

Attachment: pgpYg56wRCXRN.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index