aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/stubs
diff options
context:
space:
mode:
Diffstat (limited to 'libXfont/src/stubs')
-rw-r--r--libXfont/src/stubs/Makefile.am2
-rw-r--r--libXfont/src/stubs/Makefile.in12
-rw-r--r--libXfont/src/stubs/cauthgen.c1
-rw-r--r--libXfont/src/stubs/csignal.c1
-rw-r--r--libXfont/src/stubs/delfntcid.c1
-rw-r--r--libXfont/src/stubs/errorf.c1
-rw-r--r--libXfont/src/stubs/fatalerror.c13
-rw-r--r--libXfont/src/stubs/findoldfnt.c1
-rw-r--r--libXfont/src/stubs/getcres.c1
-rw-r--r--libXfont/src/stubs/getdefptsize.c1
-rw-r--r--libXfont/src/stubs/getnewfntcid.c1
-rw-r--r--libXfont/src/stubs/gettime.c1
-rw-r--r--libXfont/src/stubs/initfshdl.c1
-rw-r--r--libXfont/src/stubs/regfpefunc.c34
-rw-r--r--libXfont/src/stubs/rmfshdl.c3
-rw-r--r--libXfont/src/stubs/servclient.c9
-rw-r--r--libXfont/src/stubs/setfntauth.c1
-rw-r--r--libXfont/src/stubs/stfntcfnt.c1
-rw-r--r--libXfont/src/stubs/stubs.h53
-rw-r--r--libXfont/src/stubs/stubsinit.c82
20 files changed, 181 insertions, 39 deletions
diff --git a/libXfont/src/stubs/Makefile.am b/libXfont/src/stubs/Makefile.am
index 23e3bd1c6..7eb16d41a 100644
--- a/libXfont/src/stubs/Makefile.am
+++ b/libXfont/src/stubs/Makefile.am
@@ -10,7 +10,6 @@ libstubs_la_SOURCES = \
csignal.c \
delfntcid.c \
errorf.c \
- fatalerror.c \
findoldfnt.c \
getcres.c \
getdefptsize.c \
@@ -22,4 +21,5 @@ libstubs_la_SOURCES = \
servclient.c \
setfntauth.c \
stfntcfnt.c \
+ stubsinit.c \
stubs.h
diff --git a/libXfont/src/stubs/Makefile.in b/libXfont/src/stubs/Makefile.in
index 833bbe7ee..83336e1ac 100644
--- a/libXfont/src/stubs/Makefile.in
+++ b/libXfont/src/stubs/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14 from Makefile.am.
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -93,9 +93,9 @@ CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libstubs_la_LIBADD =
am_libstubs_la_OBJECTS = cauthgen.lo csignal.lo delfntcid.lo errorf.lo \
- fatalerror.lo findoldfnt.lo getcres.lo getdefptsize.lo \
- getnewfntcid.lo gettime.lo initfshdl.lo regfpefunc.lo \
- rmfshdl.lo servclient.lo setfntauth.lo stfntcfnt.lo
+ findoldfnt.lo getcres.lo getdefptsize.lo getnewfntcid.lo \
+ gettime.lo initfshdl.lo regfpefunc.lo rmfshdl.lo servclient.lo \
+ setfntauth.lo stfntcfnt.lo stubsinit.lo
libstubs_la_OBJECTS = $(am_libstubs_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -321,7 +321,6 @@ libstubs_la_SOURCES = \
csignal.c \
delfntcid.c \
errorf.c \
- fatalerror.c \
findoldfnt.c \
getcres.c \
getdefptsize.c \
@@ -333,6 +332,7 @@ libstubs_la_SOURCES = \
servclient.c \
setfntauth.c \
stfntcfnt.c \
+ stubsinit.c \
stubs.h
all: all-am
@@ -394,7 +394,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csignal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delfntcid.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errorf.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fatalerror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/findoldfnt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcres.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdefptsize.Plo@am__quote@
@@ -406,6 +405,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/servclient.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setfntauth.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stfntcfnt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubsinit.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/libXfont/src/stubs/cauthgen.c b/libXfont/src/stubs/cauthgen.c
index 026c52d17..10086e434 100644
--- a/libXfont/src/stubs/cauthgen.c
+++ b/libXfont/src/stubs/cauthgen.c
@@ -10,5 +10,6 @@
weak int
client_auth_generation(ClientPtr client)
{
+ OVERRIDE_SYMBOL(client_auth_generation, client);
return 0;
}
diff --git a/libXfont/src/stubs/csignal.c b/libXfont/src/stubs/csignal.c
index e6fdeae1b..dd88b3d36 100644
--- a/libXfont/src/stubs/csignal.c
+++ b/libXfont/src/stubs/csignal.c
@@ -10,5 +10,6 @@
weak Bool
ClientSignal(ClientPtr client)
{
+ OVERRIDE_SYMBOL(ClientSignal,client);
return True;
}
diff --git a/libXfont/src/stubs/delfntcid.c b/libXfont/src/stubs/delfntcid.c
index ca713286c..8113b9f29 100644
--- a/libXfont/src/stubs/delfntcid.c
+++ b/libXfont/src/stubs/delfntcid.c
@@ -10,4 +10,5 @@
weak void
DeleteFontClientID(Font id)
{
+ OVERRIDE_SYMBOL(DeleteFontClientID, id);
}
diff --git a/libXfont/src/stubs/errorf.c b/libXfont/src/stubs/errorf.c
index fd32965a4..d2de6c64b 100644
--- a/libXfont/src/stubs/errorf.c
+++ b/libXfont/src/stubs/errorf.c
@@ -10,4 +10,5 @@
weak void
ErrorF(const char *f, ...)
{
+ OVERRIDE_VA_SYMBOL(VErrorF, f);
}
diff --git a/libXfont/src/stubs/fatalerror.c b/libXfont/src/stubs/fatalerror.c
deleted file mode 100644
index 1549ad3ea..000000000
--- a/libXfont/src/stubs/fatalerror.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include "stubs.h"
-
-#ifdef __SUNPRO_C
-#pragma weak FatalError
-#endif
-
-weak void
-FatalError(const char *f, ...)
-{
-}
diff --git a/libXfont/src/stubs/findoldfnt.c b/libXfont/src/stubs/findoldfnt.c
index 7a0008409..c73279eb4 100644
--- a/libXfont/src/stubs/findoldfnt.c
+++ b/libXfont/src/stubs/findoldfnt.c
@@ -10,5 +10,6 @@
weak FontPtr
find_old_font(FSID id)
{
+ OVERRIDE_SYMBOL(find_old_font, id);
return (FontPtr)NULL;
}
diff --git a/libXfont/src/stubs/getcres.c b/libXfont/src/stubs/getcres.c
index 0b98f46e3..27a918080 100644
--- a/libXfont/src/stubs/getcres.c
+++ b/libXfont/src/stubs/getcres.c
@@ -10,5 +10,6 @@
weak FontResolutionPtr
GetClientResolutions(int *num)
{
+ OVERRIDE_SYMBOL(GetClientResolutions, num);
return (FontResolutionPtr) 0;
}
diff --git a/libXfont/src/stubs/getdefptsize.c b/libXfont/src/stubs/getdefptsize.c
index 0b9e40999..50c1b182c 100644
--- a/libXfont/src/stubs/getdefptsize.c
+++ b/libXfont/src/stubs/getdefptsize.c
@@ -10,5 +10,6 @@
weak int
GetDefaultPointSize(void)
{
+ OVERRIDE_SYMBOL(GetDefaultPointSize);
return 0;
}
diff --git a/libXfont/src/stubs/getnewfntcid.c b/libXfont/src/stubs/getnewfntcid.c
index e2fe8bb15..d31ccf111 100644
--- a/libXfont/src/stubs/getnewfntcid.c
+++ b/libXfont/src/stubs/getnewfntcid.c
@@ -10,5 +10,6 @@
weak Font
GetNewFontClientID(void)
{
+ OVERRIDE_SYMBOL(GetNewFontClientID);
return (Font)0;
}
diff --git a/libXfont/src/stubs/gettime.c b/libXfont/src/stubs/gettime.c
index 7b2d3b34c..1b20f62a4 100644
--- a/libXfont/src/stubs/gettime.c
+++ b/libXfont/src/stubs/gettime.c
@@ -10,5 +10,6 @@
weak unsigned long
GetTimeInMillis (void)
{
+ OVERRIDE_SYMBOL(GetTimeInMillis);
return 0;
}
diff --git a/libXfont/src/stubs/initfshdl.c b/libXfont/src/stubs/initfshdl.c
index a14dafffc..e1c0b2454 100644
--- a/libXfont/src/stubs/initfshdl.c
+++ b/libXfont/src/stubs/initfshdl.c
@@ -11,5 +11,6 @@ weak int
init_fs_handlers(FontPathElementPtr fpe,
BlockHandlerProcPtr block_handler)
{
+ OVERRIDE_SYMBOL(init_fs_handlers, fpe, block_handler);
return Successful;
}
diff --git a/libXfont/src/stubs/regfpefunc.c b/libXfont/src/stubs/regfpefunc.c
index a79b4bf92..ae12a011d 100644
--- a/libXfont/src/stubs/regfpefunc.c
+++ b/libXfont/src/stubs/regfpefunc.c
@@ -7,22 +7,26 @@
#pragma weak RegisterFPEFunctions
#endif
-weak int
-RegisterFPEFunctions(NameCheckFunc name_func,
- InitFpeFunc init_func,
- FreeFpeFunc free_func,
- ResetFpeFunc reset_func,
- OpenFontFunc open_func,
- CloseFontFunc close_func,
- ListFontsFunc list_func,
- StartLfwiFunc start_lfwi_func,
- NextLfwiFunc next_lfwi_func,
- WakeupFpeFunc wakeup_func,
- ClientDiedFunc client_died,
- LoadGlyphsFunc load_glyphs,
- StartLaFunc start_list_alias_func,
- NextLaFunc next_list_alias_func,
+weak int
+RegisterFPEFunctions(NameCheckFunc name_func,
+ InitFpeFunc init_func,
+ FreeFpeFunc free_func,
+ ResetFpeFunc reset_func,
+ OpenFontFunc open_func,
+ CloseFontFunc close_func,
+ ListFontsFunc list_func,
+ StartLfwiFunc start_lfwi_func,
+ NextLfwiFunc next_lfwi_func,
+ WakeupFpeFunc wakeup_func,
+ ClientDiedFunc client_died,
+ LoadGlyphsFunc load_glyphs,
+ StartLaFunc start_list_alias_func,
+ NextLaFunc next_list_alias_func,
SetPathFunc set_path_func)
{
+ OVERRIDE_SYMBOL(RegisterFPEFunctions, name_func, init_func, free_func,
+ reset_func, open_func, close_func, list_func, start_lfwi_func,
+ next_lfwi_func, wakeup_func, client_died, load_glyphs,
+ start_list_alias_func, next_list_alias_func, set_path_func);
return 0;
}
diff --git a/libXfont/src/stubs/rmfshdl.c b/libXfont/src/stubs/rmfshdl.c
index d0bdd3d98..22a30916c 100644
--- a/libXfont/src/stubs/rmfshdl.c
+++ b/libXfont/src/stubs/rmfshdl.c
@@ -7,9 +7,10 @@
#pragma weak remove_fs_handlers
#endif
-weak void
+weak void
remove_fs_handlers(FontPathElementPtr fpe,
BlockHandlerProcPtr blockHandler,
Bool all)
{
+ OVERRIDE_SYMBOL(remove_fs_handlers, fpe, blockHandler, all);
}
diff --git a/libXfont/src/stubs/servclient.c b/libXfont/src/stubs/servclient.c
index 9b6cebb3f..f85e08eb1 100644
--- a/libXfont/src/stubs/servclient.c
+++ b/libXfont/src/stubs/servclient.c
@@ -8,3 +8,12 @@
#endif
weak void *serverClient = 0;
+
+void *__GetServerClient(void);
+
+void *
+__GetServerClient(void)
+{
+ OVERRIDE_DATA(serverClient);
+ return serverClient;
+}
diff --git a/libXfont/src/stubs/setfntauth.c b/libXfont/src/stubs/setfntauth.c
index 0c7ecccde..371807e7a 100644
--- a/libXfont/src/stubs/setfntauth.c
+++ b/libXfont/src/stubs/setfntauth.c
@@ -10,5 +10,6 @@
weak int
set_font_authorizations(char **authorizations, int *authlen, ClientPtr client)
{
+ OVERRIDE_SYMBOL(set_font_authorizations, authorizations, authlen, client);
return 0;
}
diff --git a/libXfont/src/stubs/stfntcfnt.c b/libXfont/src/stubs/stfntcfnt.c
index 5fc17452f..d490988c5 100644
--- a/libXfont/src/stubs/stfntcfnt.c
+++ b/libXfont/src/stubs/stfntcfnt.c
@@ -10,5 +10,6 @@
weak int
StoreFontClientFont(FontPtr pfont, Font id)
{
+ OVERRIDE_SYMBOL(StoreFontClientFont, pfont, id);
return 0;
}
diff --git a/libXfont/src/stubs/stubs.h b/libXfont/src/stubs/stubs.h
index 7f0eef298..7d499d5b6 100644
--- a/libXfont/src/stubs/stubs.h
+++ b/libXfont/src/stubs/stubs.h
@@ -19,6 +19,54 @@
#endif
#endif
+#if defined(NO_WEAK_SYMBOLS) && defined(PIC)
+#include <stdarg.h>
+extern int _font_init_stubs(void);
+#define OVERRIDE_DATA(sym) \
+ _font_init_stubs(); \
+ if (__ptr_##sym && __ptr_##sym != &sym) \
+ sym = *__ptr_##sym
+#define OVERRIDE_SYMBOL(sym,...) \
+ _font_init_stubs(); \
+ if (__##sym && __##sym != sym) \
+ return (*__##sym)(__VA_ARGS__)
+#define OVERRIDE_VA_SYMBOL(sym,f) \
+ va_list _args; \
+ _font_init_stubs(); \
+ va_start(_args, f); \
+ if (__##sym) \
+ (*__##sym)(f, _args); \
+ va_end(_args)
+
+int (*__client_auth_generation)(ClientPtr);
+Bool (*__ClientSignal)(ClientPtr);
+void (*__DeleteFontClientID)(Font);
+void (*__VErrorF)(const char *, va_list);
+FontPtr (*__find_old_font)(FSID);
+FontResolutionPtr (*__GetClientResolutions)(int *);
+int (*__GetDefaultPointSize)(void);
+Font (*__GetNewFontClientID)(void);
+unsigned long (*__GetTimeInMillis)(void);
+int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr);
+int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc,
+ ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc,
+ StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc,
+ LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc);
+void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool);
+void **__ptr_serverClient;
+int (*__set_font_authorizations)(char **, int *, ClientPtr);
+int (*__StoreFontClientFont)(FontPtr, Font);
+Atom (*__MakeAtom)(const char *, unsigned, int);
+int (*__ValidAtom)(Atom);
+char *(*__NameForAtom)(Atom);
+unsigned long *__ptr_serverGeneration;
+void (*__register_fpe_functions)(void);
+#else /* NO_WEAK_SYMBOLS && PIC */
+#define OVERRIDE_DATA(sym)
+#define OVERRIDE_SYMBOL(sym,...)
+#define OVERRIDE_VA_SYMBOL(sym,f)
+#endif
+
/* This is really just a hack for now... __APPLE__ really should be using
* the weak symbols route above, but it's causing an as-yet unresolved issue,
* so we're instead building with flat_namespace.
@@ -29,13 +77,12 @@
#endif
extern FontPtr find_old_font ( FSID id );
-extern int set_font_authorizations ( char **authorizations,
- int *authlen,
+extern int set_font_authorizations ( char **authorizations,
+ int *authlen,
ClientPtr client );
extern unsigned long GetTimeInMillis (void);
extern void ErrorF(const char *format, ...);
-extern void FatalError(const char *format, ...);
/* end of file */
diff --git a/libXfont/src/stubs/stubsinit.c b/libXfont/src/stubs/stubsinit.c
new file mode 100644
index 000000000..fc52332b1
--- /dev/null
+++ b/libXfont/src/stubs/stubsinit.c
@@ -0,0 +1,82 @@
+#include "stubs.h"
+
+#if defined(NO_WEAK_SYMBOLS) && defined(PIC)
+
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#define DLOPEN_SELF() GetModuleHandle(NULL)
+#define DLSYM(h,f) GetProcAddress(h,f)
+#else
+#include <dlfcn.h>
+#define DLOPEN_SELF() dlopen(NULL, RTLD_LOCAL)
+#define DLSYM(h,f) dlsym(h, f)
+#endif
+
+int (*__client_auth_generation)(ClientPtr) = NULL;
+Bool (*__ClientSignal)(ClientPtr) = NULL;
+void (*__DeleteFontClientID)(Font) = NULL;
+void (*__VErrorF)(const char *, va_list) = NULL;
+FontPtr (*__find_old_font)(FSID) = NULL;
+FontResolutionPtr (*__GetClientResolutions)(int *) = NULL;
+int (*__GetDefaultPointSize)(void) = NULL;
+Font (*__GetNewFontClientID)(void) = NULL;
+unsigned long (*__GetTimeInMillis)(void) = NULL;
+int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr) = NULL;
+int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc,
+ ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc,
+ StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc,
+ LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc) = NULL;
+void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool) = NULL;
+void **__ptr_serverClient = NULL;
+int (*__set_font_authorizations)(char **, int *, ClientPtr) = NULL;
+int (*__StoreFontClientFont)(FontPtr, Font) = NULL;
+Atom (*__MakeAtom)(const char *, unsigned, int) = NULL;
+int (*__ValidAtom)(Atom) = NULL;
+char *(*__NameForAtom)(Atom) = NULL;
+unsigned long *__ptr_serverGeneration = NULL;
+void (*__register_fpe_functions)(void) = NULL;
+
+#define INIT_SYMBOL(sym) \
+ if (!__##sym) \
+ __##sym = (typeof(__##sym)) DLSYM(handle, #sym)
+#define INIT_DATA(sym) \
+ if (!__ptr_##sym) \
+ __ptr_##sym = (typeof(__ptr_##sym)) DLSYM(handle, #sym)
+
+int
+_font_init_stubs (void)
+{
+ static int inited = FALSE;
+ static void *handle = NULL;
+
+ if (inited)
+ return inited;
+ if (!handle)
+ handle = DLOPEN_SELF();
+
+ INIT_SYMBOL(client_auth_generation);
+ INIT_SYMBOL(ClientSignal);
+ INIT_SYMBOL(DeleteFontClientID);
+ INIT_SYMBOL(VErrorF);
+ INIT_SYMBOL(find_old_font);
+ INIT_SYMBOL(GetClientResolutions);
+ INIT_SYMBOL(GetDefaultPointSize);
+ INIT_SYMBOL(GetNewFontClientID);
+ INIT_SYMBOL(GetTimeInMillis);
+ INIT_SYMBOL(init_fs_handlers);
+ INIT_SYMBOL(RegisterFPEFunctions);
+ INIT_SYMBOL(remove_fs_handlers);
+ INIT_SYMBOL(set_font_authorizations);
+ INIT_SYMBOL(StoreFontClientFont);
+ INIT_SYMBOL(MakeAtom);
+ INIT_SYMBOL(ValidAtom);
+ INIT_SYMBOL(NameForAtom);
+ INIT_SYMBOL(register_fpe_functions);
+ INIT_DATA(serverClient);
+ INIT_DATA(serverGeneration);
+
+ inited = TRUE;
+ return inited;
+}
+
+#endif /* NO_WEAK_SYMBOLS && PIC */