summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierrick Bouvier <[email protected]>2023-11-23 12:17:28 +0400
committer<[email protected]>2023-11-23 17:17:28 +0900
commit784fdecc4c9f6ba9a8fc872518872ed6bdbc6670 ()
tree87b4eee2c395854bc56331b66536bcc82616a123
parente8b905896482f2952ccbb4d5bf0a1910edd07bf9 (diff)
windows-arm64 support (#8995)
* [win32] fix compilation for windows-arm64 Credits to MSYS2 Ruby package using this . * [win32] nm use full options Fix compilation error when using MSYS2 environment. Credits to MSYS2 Ruby package using this . * [win32] detect llvm-windres (used for windows-arm64) When adding preprocessor option for llvm-windres (using clang as parameter), it fails. Thus, do not add this. It's needed to be able to compile windows-arm64 version, because MSYS2 toolchain is LLVM based (instead of GCC/binutils). * [win32] pioinfo detection for windows-arm64 This fixes "unexpected ucrtbase.dll" for native windows-arm64 ruby binary. It does not solve issue with x64 version emulated on this platform. Value of pioinfo pointer can be found in ucrtbase.dll at latest adrp/add sequence before return of _isatty function. This works for both release and debug ucrt. Due to the nature of aarch64 ISA (vs x86 or x64), it's needed to disassemble instructions to retrieve offset value, which is a bit more complicated than matching specific string patterns. Details about adrp/add usage can be found in this blog post: https://devblogs.microsoft.com/oldnewthing/20220809-00/?p=106955 For instruction decoding, the Arm documentation was used as a reference.
-rw-r--r--configure.ac7
-rw-r--r--cygwin/GNUmakefile.in11
-rw-r--r--vm_dump.c8
-rwxr-xr-xwin32/mkexports.rb2
-rw-r--r--win32/win32.c69
5 files changed, 91 insertions, 6 deletions
@@ -509,6 +509,9 @@ AS_CASE(["$target_os"],
],
[hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <[email protected]>
AC_PROG_LN_S
AC_PROG_MAKE_SET
@@ -2664,6 +2667,9 @@ AS_CASE([$coroutine_type], [yes|''], [
[*86-mingw*], [
coroutine_type=win32
],
[arm*-linux*], [
coroutine_type=arm32
],
@@ -4239,6 +4245,7 @@ AC_SUBST(MINIOBJS)
AC_SUBST(THREAD_MODEL)
AC_SUBST(COROUTINE_TYPE, ${coroutine_type})
AC_SUBST(PLATFORM_DIR)
firstmf=`echo $FIRSTMAKEFILE | sed 's/:.*//'`
firsttmpl=`echo $FIRSTMAKEFILE | sed 's/.*://'`
@@ -3,9 +3,14 @@ gnumake = yes
include Makefile
DLLWRAP = @DLLWRAP@ --target=$(target_os) --driver-name="$(CC)"
-windres-cpp := $(CPP) -xc
-windres-cpp := --preprocessor=$(firstword $(windres-cpp)) \
- $(addprefix --preprocessor-arg=,$(wordlist 2,$(words $(windres-cpp)),$(windres-cpp)))
WINDRES = @WINDRES@ $(windres-cpp) -DRC_INVOKED
STRIP = @STRIP@
@@ -753,6 +753,14 @@ dump_thread(void *arg)
frame.AddrFrame.Offset = context.Rbp;
frame.AddrStack.Mode = AddrModeFlat;
frame.AddrStack.Offset = context.Rsp;
#else /* i386 */
mac = IMAGE_FILE_MACHINE_I386;
frame.AddrPC.Mode = AddrModeFlat;
@@ -151,7 +151,7 @@ class Exports::Cygwin < Exports
end
def each_line(objs, &block)
- IO.foreach("|#{self.class.nm} --extern --defined #{objs.join(' ')}", &block)
end
def each_export(objs)
@@ -2615,9 +2615,73 @@ set_pioinfo_extra(void)
* * https://bugs.ruby-lang.org/issues/18605
*/
char *p = (char*)get_proc_address(UCRTBASE, "_isatty", NULL);
- char *pend = p;
/* _osfile(fh) & FDEV */
# ifdef _WIN64
int32_t rel;
char *rip;
@@ -2667,7 +2731,8 @@ set_pioinfo_extra(void)
#else
__pioinfo = *(ioinfo***)(p);
#endif
-#endif
int fd;
fd = _open("NUL", O_RDONLY);