]> git.wh0rd.org - fontconfig.git/commitdiff
Eliminate .so PLT entries for local symbols. (thanks to Arjan van de Ven)
authorKeith Packard <keithp@neko.keithp.com>
Tue, 5 Sep 2006 09:24:01 +0000 (02:24 -0700)
committerKeith Packard <keithp@neko.keithp.com>
Tue, 5 Sep 2006 09:24:01 +0000 (02:24 -0700)
Using a simple shell script that processes the public headers, two header
files are constructed that map public symbols to hidden internal aliases
avoiding the assocated PLT entry for referring to a public symbol.

A few mistakes in the FcPrivate/FcPublic annotations were also discovered
through this process

31 files changed:
.gitignore
fc-arch/Makefile.am
fc-case/Makefile.am
fc-glyphname/Makefile.am
fc-lang/Makefile.am
fc-lang/fc-lang.c
fontconfig/fontconfig.h
src/Makefile.am
src/fcatomic.c
src/fcblanks.c
src/fccache.c
src/fccfg.c
src/fccharset.c
src/fcdbg.c
src/fcdefault.c
src/fcdir.c
src/fcfreetype.c
src/fcfs.c
src/fcinit.c
src/fcint.h
src/fclang.c
src/fclist.c
src/fcmatch.c
src/fcmatrix.c
src/fcname.c
src/fcpat.c
src/fcserialize.c
src/fcstr.c
src/fcxml.c
src/ftglue.c
src/makealias [new file with mode: 0755]

index 255a1f97f9cb91d95917c28ef45d81020fd41665..66a71cf2808893c0793b7258c6c292bbd6b64547 100644 (file)
@@ -1,3 +1,5 @@
+fcalias.h
+fcaliastail.h
 tags
 *.tar.gz
 .libs
index 8db30bbaa8528d76dca57767a46aba3d9b99b50d..819e37ac93a74df08112c0088383c0b707d62296 100644 (file)
@@ -47,4 +47,11 @@ $(TARG):fc-arch${EXEEXT} $(STMPL) ${top_srcdir}/src/fcint.h ../config.h
        rm -f $(TARG)
        ./fc-arch${EXEEXT} $(ARCHITECTURE) < $(STMPL) > $(TARG)
 
-CLEANFILES=$(TARG)
+ALIAS_FILES = fcalias.h fcaliastail.h
+
+BUILT_SOURCES = $(ALIAS_FILES)
+
+$(ALIAS_FILES): 
+       touch $(ALIAS_FILES)
+
+CLEANFILES=$(TARG) $(ALIAS_FILES)
index 11da16eabc4eec96da2bc08e933ed1e93f6d51c7..e498da0f5ca686408819966be4cd23c64ddb91a7 100644 (file)
@@ -52,5 +52,12 @@ $(TARG): $(STMPL) fc-case$(EXEEXT) $(SCASEFOLDING)
        rm -f $(TARG)
        ./fc-case$(EXEEXT) $(SCASEFOLDING) < $(STMPL) > $(TARG)
 
-CLEANFILES=$(TARG)
+ALIAS_FILES = fcalias.h fcaliastail.h
+
+BUILT_SOURCES = $(ALIAS_FILES)
+
+$(ALIAS_FILES): 
+       touch $(ALIAS_FILES)
+
+CLEANFILES=$(TARG) $(ALIAS_FILES)
 
index eb21101793cc0b21bb212f08f2f4266c83920be0..063ba006b77a2090c18b287809d6a9e5047ba18d 100644 (file)
@@ -47,5 +47,12 @@ $(TARG): $(STMPL) fc-glyphname$(EXEEXT) $(SGLYPHNAME)
        rm -f $(TARG)
        ./fc-glyphname$(EXEEXT) $(SGLYPHNAME) < $(STMPL) > $(TARG)
 
-CLEANFILES=$(TARG)
+ALIAS_FILES = fcalias.h fcaliastail.h
+
+BUILT_SOURCES = $(ALIAS_FILES)
+
+$(ALIAS_FILES): 
+       touch $(ALIAS_FILES)
+
+CLEANFILES=$(TARG) $(ALIAS_FILES)
 
index 5077810cbfcb6f4ab069dabab0eac08e5008dacb..8ca93991b6810e78e8e3094a51c7cca64b668eed 100644 (file)
@@ -46,4 +46,11 @@ $(TARG):$(ORTH) fc-lang${EXEEXT} $(STMPL)
        rm -f $(TARG)
        ./fc-lang${EXEEXT} -d ${srcdir} $(ORTH) < $(STMPL) > $(TARG)
 
-CLEANFILES=$(TARG)
+ALIAS_FILES = fcalias.h fcaliastail.h
+
+BUILT_SOURCES = $(ALIAS_FILES)
+
+$(ALIAS_FILES): 
+       touch $(ALIAS_FILES)
+
+CLEANFILES = $(TARG) $(ALIAS_FILES)
index 199f16f6fb3d96dc5c0ac4b72fbd869046488432..92a62ce631b27c447750b4896766a647529f917e 100644 (file)
@@ -22,7 +22,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "fcint.h"
 #include "fccharset.c"
 #include "fcstr.c"
 #include "fcserialize.c"
index 92a6d0828311aaa9c28d335e84f1005445f93852..523d47142d1ba1d5e4cae9c5178cc518dae0d4b3 100644 (file)
@@ -355,10 +355,10 @@ FcConfigGetConfigDirs (FcConfig   *config);
 FcPublic FcStrList *
 FcConfigGetConfigFiles (FcConfig    *config);
 
-FcChar8 *
+FcPublic FcChar8 *
 FcConfigGetCache (FcConfig  *config);
 
-FcBlanks *
+FcPublic FcBlanks *
 FcConfigGetBlanks (FcConfig *config);
 
 FcPublic FcStrList *
@@ -899,13 +899,13 @@ FcPublic void
 FcStrSetDestroy (FcPublic FcStrSet *set);
 
 FcPublic FcStrList *
-FcPublic FcStrListCreate (FcPublic FcStrSet *set);
+FcStrListCreate (FcPublic FcStrSet *set);
 
 FcPublic FcChar8 *
-FcPublic FcStrListNext (FcStrList *list);
+FcStrListNext (FcStrList *list);
 
 FcPublic void
-FcPublic FcStrListDone (FcStrList *list);
+FcStrListDone (FcStrList *list);
 
 /* fcxml.c */
 FcPublic FcBool
index 586594c1e024cfd5d8ed43e805c217f95da3aea6..98e353d58999dcf2ed57573bbd7bbd859499189f 100644 (file)
@@ -73,10 +73,14 @@ INCLUDES =                                          \
        -DFC_CACHEDIR='"$(FC_CACHEDIR)"'                \
        -DFONTCONFIG_PATH='"$(CONFDIR)"'
 
-EXTRA_DIST = fontconfig.def.in
+EXTRA_DIST = fontconfig.def.in makealias
 
 noinst_HEADERS=fcint.h
 
+ALIAS_FILES = fcalias.h fcaliastail.h
+
+BUILT_SOURCES = $(ALIAS_FILES)
+
 libfontconfig_la_SOURCES = \
        fcatomic.c \
        fcblanks.c \
@@ -112,3 +116,12 @@ install-data-local: install-ms-import-lib install-libtool-import-lib
 
 uninstall-local: uninstall-ms-import-lib uninstall-libtool-import-lib
 
+PUBLIC_FILES = \
+       $(top_srcdir)/fontconfig/fontconfig.h \
+       $(top_srcdir)/fontconfig/fcfreetype.h \
+       $(top_srcdir)/fontconfig/fcprivate.h
+       
+$(ALIAS_FILES): $(top_srcdir)/src/makealias $(PUBLIC_FILES)
+       sh $(top_srcdir)/src/makealias "$(top_srcdir)/src" $(PUBLIC_FILES)
+
+CLEANFILES := $(ALIAS_FILES)
index a8b30f88c5f8aa5c62b0237703339345454e9ab5..9038a5f2eea5351f694e08cc8b3c0fe122332160 100644 (file)
@@ -211,3 +211,6 @@ FcAtomicDestroy (FcAtomic *atomic)
 
     free (atomic);
 }
+#define __fcatomic__
+#include "fcaliastail.h"
+#undef __fcatomic__
index a78e85fe600199d70d9413ef4d33f208cbb71e3b..d52cca72f518271fe241dfb0b3bb781f187438c1 100644 (file)
@@ -90,3 +90,6 @@ FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4)
            return FcTrue;
     return FcFalse;
 }
+#define __fcblanks__
+#include "fcaliastail.h"
+#undef __fcblanks__
index 32c36bd43639c766a0672c64a2db64db8a9582e5..e4b04fcae7622c47196710d88160d6269431ca4b 100644 (file)
@@ -1085,3 +1085,6 @@ static void MD5Transform(FcChar32 buf[4], FcChar32 in[16])
     buf[2] += c;
     buf[3] += d;
 }
+#define __fccache__
+#include "fcaliastail.h"
+#undef __fccache__
index d9502f0d341f691deaa5b3c1825f6924bb1908f5..01d381c5f33ea118ad42adf3c8c4cc3b937065e8 100644 (file)
@@ -1964,3 +1964,6 @@ FcConfigAcceptFont (FcConfig          *config,
        return FcFalse;
     return FcTrue;
 }
+#define __fccfg__
+#include "fcaliastail.h"
+#undef __fccfg__
index 76c1530f5c03b94297f71b696f119b6f841aef7b..1c2e2eac155a2c8287d15d8e3527b2253a86a13a 100644 (file)
@@ -1358,3 +1358,6 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs)
     
     return cs_serialized;
 }
+#define __fccharset__
+#include "fcaliastail.h"
+#undef __fccharset__
index 98b57e6c38b16de02745b68a3a00d0f0a25c6f19..68f530e25d294685ccda0d08c5720a3c4e899219 100644 (file)
@@ -412,3 +412,6 @@ FcInitDebug (void)
            FcDebugVal = 0;
     }
 }
+#define __fcdbg__
+#include "fcaliastail.h"
+#undef __fcdbg__
index b69de308843e5d61ac0b7f98800ee28aa4947a35..ddf4237e1bbfe6b4c0101eeda1e9c7a8690d3727 100644 (file)
@@ -166,3 +166,6 @@ FcDefaultSubstitute (FcPattern *pattern)
        FcPatternObjectAddInteger (pattern, FC_HINT_STYLE_OBJECT, FC_HINT_FULL);
     }
 }
+#define __fcdefault__
+#include "fcaliastail.h"
+#undef __fcdefault__
index a55c5fd3a47f5d301f58887c6d141b26d663683a..bb5cfc9321d6cf3be09998d97c99ce2dae2ca3f4 100644 (file)
@@ -292,3 +292,6 @@ FcDirSave (FcFontSet *set, FcStrSet * dirs, const FcChar8 *dir)
 {
     return FcFalse; /* XXX deprecated */
 }
+#define __fcdir__
+#include "fcaliastail.h"
+#undef __fcdir__
index 3cf1686d96c3f3b5a48ecebc1c5e9295af94e9fa..96f70c372ccd13b5f9156e41f2ad450dabf8f474 100644 (file)
@@ -2952,3 +2952,7 @@ bail:
     ftglue_free(memory, gpostags);
     return complex;
 }
+
+#define __fcfreetype__
+#include "fcaliastail.h"
+#undef __fcfreetype__
index e9b2d07d4cd918e26980b2531a9f3f6e7336183e..7bea73651c5ee6ab01c1a57165b6ec0897569455 100644 (file)
@@ -130,3 +130,6 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s)
 
     return s_serialize;
 }
+#define __fcfs__
+#include "fcaliastail.h"
+#undef __fcfs__
index f64c0f0dcb1f5e03ad1d25b4e65060c995097ff3..7d2311fae2bdb5fc9112f2ea772c5d731f52ec0d 100644 (file)
@@ -263,3 +263,6 @@ FcMemFree (int kind, int size)
            FcMemReport ();
     }
 }
+#define __fcinit__
+#include "fcaliastail.h"
+#undef __fcinit__
index 7dab169a49378cd9688a2a3f96af6c3876d1da52..c50f623bd7651495c05719e3ec96e9189867546e 100644 (file)
@@ -48,6 +48,7 @@
 #include <fontconfig/fontconfig.h>
 #include <fontconfig/fcprivate.h>
 #include <fontconfig/fcfreetype.h>
+#include "fcalias.h"
 
 #ifndef FC_CONFIG_PATH
 #define FC_CONFIG_PATH "fonts.conf"
@@ -322,6 +323,8 @@ struct _FcCache {
     intptr_t   set;                /* offset to font set */
 };
 
+#undef FcCacheDir
+#undef FcCacheSubdir
 #define FcCacheDir(c)  FcOffsetMember(c,dir,FcChar8)
 #define FcCacheDirs(c) FcOffsetMember(c,dirs,intptr_t)
 #define FcCacheSet(c)  FcOffsetMember(c,set,FcFontSet)
@@ -513,7 +516,7 @@ FcCacheObjectDereference (void *object);
 FcPrivate void
 FcCacheFini (void);
     
-void
+FcPrivate void
 FcDirCacheReference (FcCache *cache, int nref);
 
 /* fccfg.c */
index f8f6f0b39eb012b63f019f269ab473859feb6ca6..de0862215d435b071df5d12c574e21dacd1247f5 100644 (file)
@@ -727,3 +727,6 @@ FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l)
     *l_serialize = *l;
     return l_serialize;
 }
+#define __fclang__
+#include "fcaliastail.h"
+#undef __fclang__
index c0b7fb0cdfc1b7a2af8b8af3a085687421e12bf4..3de04a009ec645992fbc9f9c151c41a5a150bacc 100644 (file)
@@ -556,3 +556,6 @@ FcFontList (FcConfig        *config,
        sets[nsets++] = config->fonts[FcSetApplication];
     return FcFontSetList (config, sets, nsets, p, os);
 }
+#define __fclist__
+#include "fcaliastail.h"
+#undef __fclist__
index 96587cbc310d41ac6aef92dc683ad5910f015dd5..f0410528e4c0edc42b8710a6dd5801ac243cc2d9 100644 (file)
@@ -835,3 +835,6 @@ FcFontSort (FcConfig        *config,
        sets[nsets++] = config->fonts[FcSetApplication];
     return FcFontSetSort (config, sets, nsets, p, trim, csp, result);
 }
+#define __fcmatch__
+#include "fcaliastail.h"
+#undef __fcmatch__
index 3c4d9fb84a1e332170dc895fcb1813cd9be79cc9..7f551460c44b1b733f156748a7cbd96b3a3999a9 100644 (file)
@@ -115,3 +115,6 @@ FcMatrixShear (FcMatrix *m, double sh, double sv)
     r.yy = 1;
     FcMatrixMultiply (m, &r, m);
 }
+#define __fcmatrix__
+#include "fcaliastail.h"
+#undef __fcmatrix__
index cfc6b31977f46eae0751d7ba894102d1f94def52..21e6da17295c9a8696bdb56c683668563a8caaf0 100644 (file)
@@ -879,3 +879,6 @@ bail0:
     FcStrBufDestroy (&buf);
     return 0;
 }
+#define __fcname__
+#include "fcaliastail.h"
+#undef __fcname__
index a225717370bcd8d043b76387a252afe59e5ab782..bf34c2e2c4c1869f6c12303792a4f065e60e17e1 100644 (file)
@@ -1208,3 +1208,6 @@ FcValueListSerialize (FcSerialize *serialize, const FcValueList *vl)
     }
     return head_serialized;
 }
+#define __fcpat__
+#include "fcaliastail.h"
+#undef __fcpat__
index d0d35e3413a3c10834839d29e7fb48dcc04de2ea..a66d3889acbf142b62ebe61e8c72f0327d7bcd6f 100644 (file)
@@ -159,3 +159,6 @@ FcStrSerialize (FcSerialize *serialize, const FcChar8 *str)
     strcpy ((char *) str_serialize, (const char *) str);
     return str_serialize;
 }
+#define __fcserialize__
+#include "fcaliastail.h"
+#undef __fcserialize__
index 5faf5790f8ba4e9dd3f1522b0109f16a73e4e8f2..7ec2ab4f5f92f44ecb94814f1efa489312c3b3c4 100644 (file)
@@ -1051,3 +1051,6 @@ FcStrListDone (FcStrList *list)
     free (list);
 }
 
+#define __fcstr__
+#include "fcaliastail.h"
+#undef __fcstr__
index 441e6dedf67e55a66915b926c839591c3a3bf79b..4087183372a5f4665ba15a910b03e37e36030a20 100644 (file)
@@ -2493,3 +2493,6 @@ bail0:
     }
     return FcTrue;
 }
+#define __fcxml__
+#include "fcaliastail.h"
+#undef __fcxml__
index 413a933ab1b02e3b6171ec82faf86632196650fd..9caad7c6a7ab3a45a1176b476bfe8f7c6c4e7da6 100644 (file)
@@ -307,3 +307,6 @@ Exit:
 }                        
 
 #undef QALLOC
+#define __ftglue__
+#include "fcaliastail.h"
+#undef __ftglue__
diff --git a/src/makealias b/src/makealias
new file mode 100755 (executable)
index 0000000..db76a45
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+SRCDIR=$1
+shift
+HEAD=fcalias.h
+TAIL=fcaliastail.h
+rm -f $HEAD $TAIL
+sed -n -e '/^FcPublic /,+1p' "$@" | sed -e '/^FcPublic /d' -e 's/ *(.*$//' |
+while read name; do
+       case $name in
+       FcCacheDir|FcCacheSubdir)
+               ;;
+       *)
+               alias="IA__$name"
+               hattr='__attribute((visibility("hidden")))'
+               echo "extern __typeof ($name) $alias $hattr;" >> $HEAD
+               echo "#define $name $alias" >> $HEAD
+               grep -l -w '^'$name "$SRCDIR"/*.c | sed -e 's/^.*\/\([^.]*\)\.c/#ifdef __\1__/' >> $TAIL
+               echo "#undef $name" >> $TAIL
+               cattr='__attribute((alias("'$alias'"), visibility("default")))'
+               echo "extern __typeof ($name) $name $cattr;" >> $TAIL
+               echo "#endif" >> $TAIL
+               ;;
+       esac
+done