summaryrefslogtreecommitdiff
path: root/src/util/atom.c
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2014-04-06 14:18:32 -0500
committerYaakov Selkowitz <yselkowitz@users.sourceforge.net>2014-06-27 18:31:56 -0500
commit0dcdd82059c69ec417bb094f4da2afef7cc1426a (patch)
tree2c6fb577baf6d252e728864d75b1be486e1bb364 /src/util/atom.c
parent783a406d6258509abfbdc54c0b32366dcaf13044 (diff)
Make shared library work on Cygwin/MinGW
Weak symbols on PE platforms do not work the same way as on ELF platforms, hence we have been unable to have a fully functional shared libXfont until now. This patch works around these issues so that we can fix that. In summary, only when compiling shared libraries on NO_WEAK_SYMBOLS platforms, when the first stub is called, the invoking program is first checked to determine if it exports the stubbed functions. Then, for every stub call, if the function is exported by the loader, it is called instead of the stub code. serverClient and serverGeneration are data pointers, and therefore are replaced by getter functions. ErrorF is variadic, so the override is routed through VErrorF instead. FatalError has no va_list equivalent, but it is not actually used in libXfont and therefore should be safe to remove. This requires all X servers to export their symbols, which requires forthcoming patches for hw/xwin and xfs; the other xservers (including tigervnc) already do this via LD_EXPORT_SYMBOLS_FLAG. Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Reviewed-by: Colin Harrison <colin.harrison@virgin.net> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com> Tested-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Diffstat (limited to 'src/util/atom.c')
-rw-r--r--src/util/atom.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util/atom.c b/src/util/atom.c
index 37811f9..5f7f1c6 100644
--- a/src/util/atom.c
+++ b/src/util/atom.c
@@ -158,6 +158,8 @@ MakeAtom(const char *string, unsigned len, int makeit)
int h = 0;
int r;
+ OVERRIDE_SYMBOL(MakeAtom, string, len, makeit);
+
hash = Hash (string, len);
if (hashTable)
{
@@ -230,6 +232,7 @@ MakeAtom(const char *string, unsigned len, int makeit)
weak int
ValidAtom(Atom atom)
{
+ OVERRIDE_SYMBOL(ValidAtom, atom);
return (atom != None) && (atom <= lastAtom);
}
@@ -240,6 +243,7 @@ ValidAtom(Atom atom)
weak char *
NameForAtom(Atom atom)
{
+ OVERRIDE_SYMBOL(NameForAtom, atom);
if (atom != None && atom <= lastAtom)
return reverseMap[atom]->name;
return NULL;