aboutsummaryrefslogtreecommitdiffstats
path: root/win32
Commit message (Collapse)AuthorAgeFilesLines
* windows-arm64 support (#8995)Pierrick Bouvier2023-11-232-3/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [win32] fix compilation for windows-arm64 Credits to MSYS2 Ruby package using this patch. * [win32] nm use full options Fix compilation error when using MSYS2 environment. Credits to MSYS2 Ruby package using this patch. * [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.
* [Bug #18286] Make builtin binary if sharable in universal binariesNobuyoshi Nakada2023-11-091-0/+2
|
* [Feature #19244] Windows: Prefer USERPROFILE over HOMEPATH on startup as wellLars Kanis2023-10-271-13/+16
|
* Rename YARP symbols to prismKevin Newton2023-09-271-3/+3
|
* Add `rb_w32_uspawn_process`Nobuyoshi Nakada2023-09-252-5/+29
|
* Move YARP_BUILD_DIR to common.mkNobuyoshi Nakada2023-09-211-2/+0
| | | It does not need to be an absolute path.
* Revert "Fix tool/update-deps for YARP files"Takashi Kokubun2023-08-181-18/+0
| | | | | | | | | | | | | | | | | | | | | This reverts commit 6fff5c5ba23a2790c9d189de82e157c9fa986f96. Revert "Use $(top_srcdir) entries for mswin (#8244)" This reverts commit e327bf32bdfa610a0f1834048bb1422de992c073. Revert "Update dependencies" This reverts commit aba26a88040c322a188292447fd18a2b9c76c713. Revert "Use {$(VPATH)} for OpenBSD" This reverts commit 2046e054bc811fd6a8e30c926aa6c9c4a5884262. --- None of those revisions actually worked for both mswin and OpenBSD at the same time. I need more time to build something that works for both.
* Use $(top_srcdir) entries for mswin (#8244)Takashi Kokubun2023-08-181-0/+18
| | | | While the $(VPATH) rules live in common.mk, mswin seems to ignore them. We need to use $(VPATH) for OpenBSD, but we need to use the other one for mswin.
* Use `::` form workflow commandsNobuyoshi Nakada2023-08-151-2/+3
|
* Clean up OPT_STACK_CACHING (#8132)Takashi Kokubun2023-07-271-1/+1
|
* Don't check for null pointer in calls to freePeter Zhu2023-06-302-34/+17
| | | | | | | | According to the C99 specification section 7.20.3.2 paragraph 2: > If ptr is a null pointer, no action occurs. So we do not need to check that the pointer is a null pointer.
* [Feature #19741] Add yarp to buildsJemma Issroff2023-06-211-0/+11
| | | | | Add yarp to common.mk and windows builds to enable us to run yarp correctly with CI.
* Fix the case no file under bin directoryNobuyoshi Nakada2023-06-021-0/+2
| | | | NMake cannot handle empty expanded targets.
* Hide the usage of `rb_io_t` where possible. (#7880)Samuel Williams2023-06-011-4/+1
| | | This retries the compatible parts of the previously reverted PR so we can continue to update related code without breaking backwards compatibility.
* Revert "Hide most of the implementation of `struct rb_io`. (#6511)"NARUSE, Yui2023-06-011-1/+4
| | | | | | | | | This reverts commit 18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2. fix [Bug #19704] https://bugs.ruby-lang.org/issues/19704 This breaks compatibility for extension libraries. Such changes need a discussion.
* Hide most of the implementation of `struct rb_io`. (#6511)Samuel Williams2023-05-301-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Add rb_io_path and rb_io_open_descriptor. * Use rb_io_open_descriptor to create PTY objects * Rename FMODE_PREP -> FMODE_EXTERNAL and expose it FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but FMODE_EXTERNAL is clearer about what the file descriptor represents and aligns with language in the IO::Buffer module. * Ensure that rb_io_open_descriptor closes the FD if it fails If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be responsible for closing your file, eventually, if you pass it to rb_io_open_descriptor, even if it raises an exception. * Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P * Expose `rb_io_closed_p`. * Add `rb_io_mode` to get IO mode. --------- Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
* Fix "runs a C function with the global lock unlocked and unlocks IO with the ↵Samuel Williams2023-05-241-8/+22
| | | | | | | | | generic RUBY_UBF_IO" on Windows. (#7848) * Enable borked spec. * Ensure win32 wrappers are visible and used. * Reorganise `read`/`write`/`pipe` in `thread_spec.c`.
* Add support for pread/pwrite on windows. (#7827)Samuel Williams2023-05-241-21/+68
|
* Use Lrama LALR parser generator instead of Bisonv3_3_0_preview1Yuichiro Kaneko2023-05-121-1/+1
| | | | | https://bugs.ruby-lang.org/issues/19637 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
* Add rubyspec-capiext on mswinNobuyoshi Nakada2023-04-211-0/+30
|
* [DOC] Remove obsolete win32/.documentAlan Wu2023-04-111-1/+0
| | | | The README file moved in f499c81b01b5c4b7a2ce11d6467d793669d67695.
* s/MJIT/RJIT/Takashi Kokubun2023-03-063-8/+8
|
* Remove obsoleted mjit_sp_inc.inc.erbTakashi Kokubun2023-03-061-1/+1
|
* Stop exporting symbols for MJITTakashi Kokubun2023-03-061-1/+1
|
* Revert "reuse open(2) from rb_file_load_ok on POSIX-like system"Takashi Kokubun2023-02-271-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 35136e1e9c232ad7a03407b992b2e86b6df43f63. test-spec has been failing since this revision. .github/workflows/compilers.yml:82 https://github.com/ruby/ruby/actions/runs/4276884159/jobs/7445299562 ``` env: # Minimal flags to pass the check. default_cc: 'gcc-11 -fcf-protection -Wa,--generate-missing-build-notes=yes' optflags: '-O2' LDFLAGS: '-Wl,-z,now' # FIXME: Drop skipping options # https://bugs.ruby-lang.org/issues/18061 # https://sourceware.org/annobin/annobin.html/Test-pie.html TEST_ANNOCHECK_OPTS: "--skip-pie --skip-gaps" ``` Failure: ``` 1) An exception occurred during: Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317 Kernel#require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 2) An exception occurred during: Kernel#require ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330 Kernel#require ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 3) An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535 Kernel#require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 4) An exception occurred during: Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551 Kernel#require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 5) An exception occurred during: Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563 Kernel#require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR LeakError: Closed file descriptor: 8 Closed file descriptor: 9 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:5:in `<top (required)>' 6) An exception occurred during: Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:317 Kernel.require (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 7) An exception occurred during: Kernel.require ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:330 Kernel.require ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 8) An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:535 Kernel.require ($LOADED_FEATURES) does not load a non-canonical path for a file already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 9) An exception occurred during: Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:551 Kernel.require ($LOADED_FEATURES) does not load a ../ relative path for a file already loaded ERROR LeakError: Leaked file descriptor: 9 : #<File:../code/load_fixture.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 10) An exception occurred during: Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required /__w/ruby/ruby/src/spec/ruby/core/kernel/shared/require.rb:563 Kernel.require ($LOADED_FEATURES) complex, enumerator, rational, thread, ruby2_keywords are already required ERROR LeakError: Closed file descriptor: 8 Closed file descriptor: 9 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_spec.rb:23:in `<top (required)>' 11) An exception occurred during: Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:197 Kernel#require_relative with a relative path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>' 12) An exception occurred during: Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:205 Kernel#require_relative with a relative path ($LOADED_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:4:in `<top (required)>' 13) An exception occurred during: Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:399 Kernel#require_relative with an absolute path (file extensions) does not load a C-extension file if a complex-extensioned .rb file is already loaded ERROR LeakError: Leaked file descriptor: 8 : #<File:/__w/ruby/ruby/src/spec/ruby/fixtures/code/load_fixture.ext.rb> /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>' 14) An exception occurred during: Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:407 Kernel#require_relative with an absolute path ($LOAD_FEATURES) stores an absolute path ERROR LeakError: Closed file descriptor: 8 /__w/ruby/ruby/src/spec/ruby/core/kernel/require_relative_spec.rb:277:in `<top (required)>' ```
* Prefer to use File.foreach instead of IO.foreachHiroshi SHIBATA2023-02-271-1/+1
|
* reuse open(2) from rb_file_load_ok on POSIX-like systemEric Wong2023-02-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When loading Ruby source files, we can save the result of successful opens as open(2)/openat(2) are a fairly expensive syscalls. This also avoids a time-of-check-to-time-of-use (TOCTTOU) problem. This reduces open(2) syscalls during `require'; but should be most apparent when users have a small $LOAD_PATH. Users with large $LOAD_PATH will benefit less since there'll be more open(2) failures due to ENOENT. With `strace -c -e openat ruby -e exit' under Linux, this results in a ~14% reduction of openat(2) syscalls (glibc uses openat(2) to implement open(2)). % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 0.00 0.000000 0 296 110 openat 0.00 0.000000 0 254 110 openat Additionally, the introduction of `struct ruby_file_load_state' may make future optimizations more apparent. This change cannot benefit binary (.so) loading since the dlopen(3) API requires a filename and I'm not aware of an alternative that takes a pre-existing FD. In typical situations, Ruby source files outnumber the mount of .so files.
* Adjust `else` style to be consistent in each files [ci skip]Nobuyoshi Nakada2023-02-261-2/+4
|
* Extract include/ruby/internal/attr/packed_struct.hNobuyoshi Nakada2023-02-081-8/+2
| | | | | | | | | Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the macros bellow: * `RBIMPL_ATTR_PACKED_STRUCT_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_END` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END`
* [DOC] Merge README.win32 to doc/windows.mdNobuyoshi Nakada2023-02-021-149/+0
|
* Reject VS2022 compiler versions with the known bugsNobuyoshi Nakada2023-02-012-5/+4
|
* Windows: Prefer USERPROFILE over HOMEPATHLars Kanis2022-12-241-9/+9
| | | | | | | | | HOMEPATH is set to "\WINDOWS\system32" when running per "runas" session. This directory is not writable by ordinary users, leading to errors with many ruby tools. Also config files in the home directory are not recognized. Still keeping HOME at first which is not used by native Windows, but by ruby specs and by MSYS2 environment.
* Windows: Fix encoding of Dir.homeLars Kanis2022-12-241-1/+2
| | | | | | | Dir.home returns an UTF-8 string since ruby-3.0, but the actual encoding of the bytes was CP_ACP or CP_OEMCP. That led to invalid bytes when calling Dir.home with an unicode username.
* Win32: add dependency of revision.hNobuyoshi Nakada2022-12-211-0/+4
| | | | | When out-of-place build, and revision.h does not exist in the source directory, `VPATH` fallbacks to the current directory.
* MSVS lacks `touch` [ci skip]Nobuyoshi Nakada2022-12-201-0/+1
|
* Add more comments why CRuby uses __pioinfoNARUSE, Yui2022-12-151-0/+12
|
* Win32: Move fallback BASERUBY definitionNobuyoshi Nakada2022-12-102-12/+17
|
* Handle depend files on nmakeNobuyoshi Nakada2022-12-051-0/+3
|
* Use class methods of `File` over `Kernel.open` and `IO.read`Nobuyoshi Nakada2022-12-011-1/+1
|
* MJIT: Rename mjit_compile_attr to mjit_sp_incTakashi Kokubun2022-11-291-1/+1
| | | | There's no mjit_compile.inc, so no need to use this prefix anymore.
* Use `rb_sprintf` instead of deprecated `sprintf`Nobuyoshi Nakada2022-11-251-4/+6
|
* Use class methods of `File` over `Kernel.open` and `IO.read`Nobuyoshi Nakada2022-11-211-1/+1
|
* Avoid warnings on MINGW:Lars Kanis2022-11-201-0/+4
| | | | | | | | | | | | | win32/win32.c: In function 'rtc_error_handler': win32/win32.c:691:5: warning: function 'rtc_error_handler' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] 691 | rb_str_vcatf(str, fmt, ap); | ^~~~~~~~~~~~ and win32/win32.c:683:1: warning: 'rtc_error_handler' defined but not used [-Wunused-function] 683 | rtc_error_handler(int e, const char *src, int line, const char *exe, const char *fmt, ...) | ^~~~~~~~~~~~~~~~~
* Add support for `sockaddr_un` on Windows. (#6513)Samuel Williams2022-11-173-19/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Windows: Fix warning about undefined if_indextoname() * Windows: Fix UNIXSocket on MINGW and make .pair more reliable * Windows: Use nonblock=true for read tests with scheduler * Windows: Move socket detection from File.socket? to File.stat Add S_IFSOCK to Windows and interpret reparse points accordingly. Enable tests that work now. * Windows: Use wide-char functions to UNIXSocket This fixes behaviour with non-ASCII characters. It also fixes deletion of temporary UNIXSocket.pair files. * Windows: Add UNIXSocket tests for specifics of Windows impl. * Windows: fix VC build due to missing _snwprintf Avoid usage of _snwprintf, since it fails linking ruby.dll like so: linking shared-library x64-vcruntime140-ruby320.dll x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol snwprintf x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol vsnwprintf_l whereas linking miniruby.exe succeeds. This patch uses snprintf on the UTF-8 string instead. Also remove branch GetWindowsDirectoryW, since it doesn't work. * Windows: Fix dangling symlink test failures Co-authored-by: Lars Kanis <kanis@comcard.de>
* Windows: Readlink improvements (#6745)Lars Kanis2022-11-173-63/+20
| | | | | | | | | | | | | | | | | | | * Windows: Use readlink emulation for File.readlink This fixes readlink emulation for the ERROR_MORE_DATA case and general error reporting. It now releases GVL while readlink IO operation. The dedicated rb_readlink was introduced in commit 2ffb87995a33cdc7ba609a4b867f03f18da0c3b3 in order to improve encoding and buffer allocation. However the encoding issues are solved since ruby-3.0 switched to UTF-8 and the buffer allocation will be improved in a later commit. * Windows: Increase the default buffer size for reparse point info So far nearly all queries of reparse points needed two attempts to get enough buffer. * Windows: Remove declaration of rb_w32_wreadlink It was removed in commit 2f6fdd3aebdee2ce04d003b206f6da78120e8235
* [win32] Only include base windows typesJosh Cooper2022-10-261-1/+1
| | | | | | esent.h is the header for MS essential storage engine (JET) which is not needed in ruby. basetsd.h has existed since _MSC_VER >= 1200 (VS 6.0) and is the preferred header to use for WCHAR.
* Demote mjit_instruction.rb from builtin to stdlibTakashi Kokubun2022-09-181-4/+0
|
* Always generate non-empty revision.hTakashi Kokubun2022-09-171-2/+0
| | | | | | | | | | Non-GNU make seems to generate empty revision.h, but it doesn't make sense since https://github.com/ruby/ruby/pull/6382. Also the $(HAVE_BASERUBY:yes=tmp) hack doesn't seem to be working on OpenBSD. I'll remove it to focus on fixing RubyCI first, and then deal with baseruby-missing environments. At least a snapshot should have revision.h and it might work fine though.
* Auto-generate the release date on version.h from git CommitDate (#6382)Takashi Kokubun2022-09-172-0/+3
| | | | | | | * Auto-generate the release date on version.h from git CommitDate * Generate revision.h on mswin
* Add GMP support for mswinU.Nakamura2022-09-133-0/+17
|