675 Commits

Author SHA1 Message Date
Lars Kanis
806031d2ce Windows: Remove workaround for LLVM windres
It was introduced as part of the Arm64-on-Windows patch:
  https://github.com/ruby/ruby/pull/8995

But a few days later it was fixed on the LLVM side for llvm-18 and backported to MSYS2:
  https://github.com/msys2/MINGW-packages/pull/19157#issuecomment-1825285063

Now this code is only unnecessary complexity.
2026-01-15 11:14:54 +09:00
Nobuyoshi Nakada
1852ef4377
Fail if the Ruby specified with --with-baseruby is too old
If the baseruby is explicitly specified, fail because the option is
not accepted if it does not meet the requirements.  If the option is
not specified, just display the warning and continue, in the hope that
it is not needed.

Follow up GH-15809
2026-01-08 13:30:47 +09:00
Jarek Prokop
25c72b0e8e Support customizable rustc_flags for rustc builds.
Add `rustc_flags` option for configure that appends to RUSTC_FLAGS
flags used when compiling with rustc for customizable build flags.
It appends to existing defaults in RUSTC_FLAGS.

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2026-01-06 23:55:06 -05:00
Matt Valentine-House
49ca241d6d Show a more verbose message if BASERUBY is too old 2026-01-06 17:09:27 +00:00
Nobuyoshi Nakada
c26057ebaf
[Bug #21779] Do not export InitVM functions
Fix ruby/io-console#105.
2025-12-14 11:11:52 +09:00
Alan Wu
eb889e474d ZJIT: s/checking possible to build ZJIT/checking prerequisites for ZJIT/
Reads better to me:

> checking prerequisites for ZJIT... yes
2025-12-11 15:45:56 -05:00
Alan Wu
832aac6c28 Tune AS_CASE indentation style and remove [*] for default case
There are many indentation styles for AS_CASE in this file but no one
uses `[*]` for the default case.
2025-12-11 15:45:56 -05:00
Nobuyoshi Nakada
83e080705c
Remove an excess closing bracket 2025-12-11 10:28:03 +09:00
Alan Wu
029a48176c JITs: Drop cargo and use just rustc for release combo build
So we don't expose builders to network flakiness which cannot be worked
around using cargo's --offline flag.
2025-12-10 16:35:00 -05:00
Alan Wu
d396a66a82 ZJIT: Build by default when build environment allows
"Default" means when `--enable-zjit` is absent from `./configure`
arguments.
2025-12-05 15:49:25 -05:00
Alan Wu
f559a9106c ZJIT: configure.ac: Look for GNU make when detecting build environment
Building ZJIT requires GNU make at the moment.
To get access to `$gnumake`, lift the `make` flavour detection up to the
environment section, before the JIT section runs.
2025-12-05 15:49:25 -05:00
Alan Wu
ffe99a56de ZJIT: configure.ac logic to detect suitable build environment
This runs the detection, but does nothing with the result.

 * Fixed version requirement in messages -- ZJIT requires >= 1.85 unlike
  YJIT.
 * New: Detect when rust 1.85 is available, and neither --enable-yjit nor
  --enable-zjit is passed to ./configure, include both YJIT and ZJIT
  in the build
2025-12-05 15:49:25 -05:00
Nobuyoshi Nakada
d7cfd275f8
Set DESTDIR if relative loading
When relative loading, `prefix` makes no sense actually.  Use the
given (or default) path as `DESTDIR` instead.

This change affects only when the relative loading is enabled and the
destdir is not given, and does not change the final installation path,
but makes the configuration options simpler a little.
2025-11-30 14:31:34 +09:00
Nobuyoshi Nakada
26a9e0b4e3
Reset the cache variable before retrying 2025-11-26 10:47:17 +09:00
Nobuyoshi Nakada
2957ba7079 Try libatomic only if necessary 2025-11-25 13:47:45 +09:00
Nobuyoshi Nakada
bbf4bde75e Reapply "Fix stdatomic case in rbimpl_atomic_u64_fetch_add"
This reverts commit 8a68dc7bdd3d1c97677a6633a4f2b5e524c492ae.
2025-11-25 13:47:45 +09:00
Max Bernstein
8a68dc7bdd
Revert "Fix stdatomic case in rbimpl_atomic_u64_fetch_add" (#15311)
This reverts commit d3b6f835d565ec1590059773fc87589ddf8adc37.

This broke the Docker builds and presumably also 32-bit machines that
don't already have libatomic installed.
2025-11-24 15:28:30 -05:00
Nobuyoshi Nakada
d3b6f835d5
Fix stdatomic case in rbimpl_atomic_u64_fetch_add
On some platoforms, 64bit atomic operations need the dedicated helper
library.
2025-11-22 01:20:04 +09:00
Nobuyoshi Nakada
7840ef2f43
Win32: Allow some mingw implemeations to use old msvcrt 2025-11-19 22:51:09 +09:00
Nobuyoshi Nakada
7743123551 Win32: Drop support for older than MSVC 12.0/_MSC_VER 1800
Visual C++ 2013 (12.0):
- _MSC_VER: 1800
- MSVCRT_VERSION: 120
2025-11-19 11:03:42 +09:00
Nobuyoshi Nakada
3dd39134cd Win32: Drop support for older than MSVC 9.0/_MSC_VER 1500
Visual C++ 2008 (9.0):
- _MSC_VER: 1500
- MSVCRT_VERSION: 90
2025-11-19 11:03:42 +09:00
Nobuyoshi Nakada
cdb9893c55 Win32: Drop support for older than MSVC 8.0/_MSC_VER 1400
Visual C++ 2005 (8.0):
- _MSC_VER: 1400
- MSVCRT_VERSION: 80
2025-11-19 11:03:42 +09:00
Nobuyoshi Nakada
87593f2c0f
Disable shorten-64-to-32 warning on IL32LLP64
Disable the shorten-64-to-32 warning for now, because it currently
generates a lot of warnings on platforms where `sizeof(void*)` is
larger than `sizeof(long)`.

TODO: Replace `long` with `ptrdiff_t` or something in the all sources.
2025-10-17 15:09:16 +09:00
Nobuyoshi Nakada
485f079dc5
win32: OBJCOPY is not needed on Windows in favor of def file 2025-10-17 15:09:15 +09:00
Nobuyoshi Nakada
89961f8581
configure.ac: Update caches for functions defined in win32.c 2025-10-17 15:09:15 +09:00
Nobuyoshi Nakada
ce1ed871b7
Revert "Already git 2.32 is expected in doc/contributing/building_ruby.md"
This reverts commit fbc7e935761d892ba6c031256ccbb914963e4ce1.

Failures with "GCC 8" and "clang 12".
```
/github/workspace/src/tool/lib/vcs.rb:57:in `system': Command failed
with status (pid 7385 exit 128): ["git", "config", "--global",
"--add", "safe.directory", "/github/workspace/src"] (RuntimeError)
```
2025-09-17 21:22:11 +09:00
Nobuyoshi Nakada
fbc7e93576
Already git 2.32 is expected in doc/contributing/building_ruby.md 2025-09-17 14:34:57 +09:00
André Luiz Tiago Soares
52b22f815f
ZJIT: Debug mechanism to verify leafness for gen_prepare_call_with_gc (#14553)
* functional debug mechanism; small refactor

* make all tests pass

* clean up implementation of debug mechanism for gen_prepare_call_with_gc

* revert unnecessary change to gen_object_alloc

* make ObjectAlloc non-leaf

* fix merge error; reintroduce accidentally deleted counter

* remove outdated comment

* changes as per review comments

* make set_stack_canary more stable

* add todo comment to specialize object_alloc

* revert whitespace changes

* create gen_prepare_leaf_call_with_gc helper

* fix spacing
2025-09-16 16:38:53 -07:00
Nobuyoshi Nakada
a6a5fe3222
Suppress verification messages
`log.showSignature` configuration and `--no-show-signature` option was
added at git 2.10.0.
2025-09-16 20:28:37 +09:00
Nobuyoshi Nakada
5480a9c344
Reject git command that does not accept -C option 2025-09-16 20:28:37 +09:00
Aiden Fox Ivey
f75e1cb362 ZJIT: Move jit.rs to ruby.rs and create a shared crate jit
* ruby.rs should hold the main entrypoint to YJIT and ZJIT
* The crate jit will hold code shared between them
2025-09-11 21:51:47 -07:00
Nobuyoshi Nakada
89110b2743
Remove obsolete option --enable-mathn
The code has been removed already, and the latest mathn is refactored
to use refinements.
2025-09-03 18:31:46 +09:00
Nobuyoshi Nakada
6023195fbd
Abandon ruby target on the others than GNU make
The default non-transformed name, `ruby` target was added for the case
of `--program-transform-name` and similars, but it was occasionally
added even when no such option is used.
2025-08-28 19:01:48 +09:00
Nobuyoshi Nakada
a837ec0962 Drop a workaround for CentOS 6
`RUBY_CXX_DEPRECATED` is overridden using `RBIMPL_ATTR_DEPRECATED` in
include/ruby/backward/2/attributes.h already.
2025-08-21 20:32:19 +09:00
Nobuyoshi Nakada
683dd92de8
cd using the physical directory from symlinked build directory 2025-08-20 18:09:34 +09:00
Nobuyoshi Nakada
d0d7f55005
Gererate prism source files dependencies from template.rb
Update included file list automatically.
2025-08-19 11:55:23 +09:00
Nobuyoshi Nakada
90cb2bb871 Gererate prism source files dependencies from template.rb 2025-08-18 01:01:31 +09:00
Takashi Kokubun
b22eb0e468
ZJIT: Add --zjit-stats (#14034) 2025-07-29 10:00:15 -07:00
Hiroshi SHIBATA
be7b1164e6 Split autogenerated dependency to depend file from common.mk 2025-07-25 19:50:06 +09:00
John Hawthorn
7f25b8f5fb Disable TSAN for rb_gc_mark_machine_context
Previously this was listed as a suppression, but we actually want this
permanently unsanitized. This should be faster and more reliable since
TASN won't have to match against symbolicated backtraces.
2025-07-24 16:35:42 -07:00
Nobuyoshi Nakada
5239dc8a0b Revert "Suppress occasional autoconf warnings"
This reverts commit 32bfb61d349b49ddedb7d34d9e434063324aafcc, that
requires autoconf 2.70's improved whitespace handling.  It is too
early for some platforms yet.

Fix GH-13910
2025-07-17 09:53:24 +09:00
Alan Wu
5ee3937a9c ZJIT: Have make zjit-test use the same Cargo features as miniruby
This is so that e.g. building with `--enable-zjit=dev` will test with the
disassembly feature. It makes more sense, saves on build time and
reveals that
`backend::arm64::tests::sp_movements_are_single_instruction` was in
fact failing with the `disasm` feature.
2025-07-16 14:10:22 -04:00
Nobuyoshi Nakada
32bfb61d34 Suppress occasional autoconf warnings
```
configure.ac:2803: warning: AC_CHECK_FUNCS(\
): you should use literals
../autoconf-2.72/lib/autoconf/functions.m4:117: AC_CHECK_FUNCS is expanded from...
../autoconf-2.72/lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
```
2025-07-16 18:48:35 +09:00
Nobuyoshi Nakada
c5f7d274d7
Check for 64bit atomic operations
May not be supported on some 32bit architectures.

```
/usr/lib/gcc-cross/m68k-linux-gnu/14/../../../../m68k-linux-gnu/bin/ld: ../../libruby-static.a(vm.o): in function `rbimpl_atomic_u64_set_relaxed':
/home/ubuntu/build/ruby/master/m68k-linux/../src/ruby_atomic.h:60:(.text+0x2468): undefined reference to `__atomic_store_8'
/usr/lib/gcc-cross/m68k-linux-gnu/14/../../../../m68k-linux-gnu/bin/ld: ../../libruby-static.a(vm.o): in function `rbimpl_atomic_u64_load_relaxed':
/home/ubuntu/build/ruby/master/m68k-linux/../src/ruby_atomic.h:43:(.text+0x2950):
undefined reference to `__atomic_load_8'
```
2025-06-04 15:31:28 +09:00
Takashi Kokubun
cce89a6f69
ZJIT: Add --enable-zjit=dev_nodebug (#13456) 2025-05-28 17:20:10 -04:00
Nobuyoshi Nakada
8dbff6e402
Silence error messages of cd to non-existent opt directories 2025-05-20 20:43:58 +09:00
Takashi Kokubun
a7ef9a44a6
ZJIT: Propagate disasm feature to ZJIT and YJIT (#13372)
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
2025-05-19 10:34:29 -07:00
Alan Wu
92b218fbc3 YJIT: ZJIT: Allow both JITs in the same build
This commit allows building YJIT and ZJIT simultaneously, a "combo
build". Previously, `./configure --enable-yjit --enable-zjit` failed. At
runtime, though, only one of the two can be enabled at a time.

Add a root Cargo workspace that contains both the yjit and zjit crate.
The common Rust build integration mechanisms are factored out into
defs/jit.mk.

Combo YJIT+ZJIT dev builds are supported; if either JIT uses
`--enable-*=dev`, both of them are built in dev mode.

The combo build requires Cargo, but building one JIT at a time with only
rustc in release build remains supported.
2025-05-15 00:39:03 +09:00
Nobuyoshi Nakada
46e4c86737 Detect clock_gettime and clock_getres for winpthreads 2025-05-12 17:45:39 +09:00
Alan Wu
33909a1c69 YJIT: ZJIT: Share identical glue functions
Working towards having YJIT and ZJIT in the same build, we need to
deduplicate some glue code that would otherwise cause name collision.
Add jit.c for this and build it for YJIT and ZJIT builds. Update bindgen
to look at jit.c; some shuffling of functions in the output, but the set
of functions shouldn't have changed.
2025-05-02 23:47:57 +09:00