diff options
author | Yaakov Selkowitz <yselkowitz@users.sourceforge.net> | 2014-08-10 12:44:26 -0500 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2015-04-21 13:50:18 +0100 |
commit | 0c2c7562426aec7bdf9b54a7d6993153e0bce489 (patch) | |
tree | 4387ea7b8845ead6deb4fd3190883acffed3a198 /src | |
parent | 171d82fa36bb601360da2cc519718c46f137c467 (diff) | |
download | xorg-lib-libXt-0c2c7562426aec7bdf9b54a7d6993153e0bce489.tar.gz |
Fix _XtInherit on x86_64 Windows
As noted in Initialize.c, _XtInherit needs special treatment as it's both called
as a function, and used as a value to compare with.
We need to change this trickery for x86_64, as the symbols are no longer
underscore prefixed, and the address is 64 bits.
We also cannot place the trampoline in the .data section, as it may be marked
no-execute, so we use a special section for it instead.
v2: Uses of XtInherit must also be marked dllimport, so that they do not use a
thunk, but instead indirect via the __imp_XtInherit auto-import. This avoids
problems with an incorrect relocation being calculated in the case where libXt
and a library using it (e.g. libXaw/libXaw3d/libXm/etc.) are loaded more than
2GiB apart from each other.
This is enough to build a working libXt for Cygwin x86_64, because it uses the
LP64 data model. I believe that more patches are needed for libXt to work
correctly when built for the Windows LLP64 data model.
Signed-off-by: Yaakov Selkowitz <yselkowitz@cygwin.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/Initialize.c | 9 | ||||
-rw-r--r-- | src/Makefile.am | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/Initialize.c b/src/Initialize.c index 9783deb..61c8575 100644 --- a/src/Initialize.c +++ b/src/Initialize.c @@ -245,11 +245,20 @@ void _XtInherit(void) * cygwin-xfree: http://www.cygwin.com/ml/cygwin-xfree/2003-10/msg00000.html */ +#ifdef __x86_64__ +asm (".section .trampoline, \"dwx\" \n\ + .globl _XtInherit \n\ + _XtInherit: \n\ + jmp *_y(%rip) \n\ +_y: .quad __XtInherit \n\ + .text \n"); +#else asm (".data\n\ .globl __XtInherit \n\ __XtInherit: jmp *_y \n\ _y: .long ___XtInherit \n\ .text \n"); +#endif #define _XtInherit __XtInherit #endif diff --git a/src/Makefile.am b/src/Makefile.am index 8c1a664..7f8ba6d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ SRCH_DEFINES = -DXFILESEARCHPATHDEFAULT=\"$(XFILESEARCHPATHDEFAULT)\" ERRORDB_DEFINES = -DERRORDB=\"$(ERRORDBDIR)/XtErrorDB\" AM_CFLAGS = $(CWARNFLAGS) $(XT_CFLAGS) $(SRCH_DEFINES) $(ERRORDB_DEFINES) \ - $(XTMALLOC_ZERO_CFLAGS) + $(XTMALLOC_ZERO_CFLAGS) -DLIBXT_COMPILATION AM_CPPFLAGS = -I$(top_srcdir)/include/ -I$(top_srcdir)/include/X11 \ -I$(top_builddir)/include -I$(top_builddir)/include/X11 |