summaryrefslogtreecommitdiff
path: root/template
AgeCommit message (Collapse)Author
2025-12-16merge revision(s) bc2a8a002a6c41fc1b28e02e15e2fb2b72d1b66e, ↵Takashi Kokubun
c26057ebafb23b063190d31d5b4d19a0e0a1306c: [Backport #21779] [PATCH] [Bug #21779] Uniquify `InitVM` functions as well as `Init` Avoid possible name conflict when `--with-static-linked-ext`. [PATCH] [Bug #21779] Do not export InitVM functions Fix ruby/io-console#105.
2025-08-27[Backport #21546] Make the generated pc file relocatableNobuyoshi Nakada
2025-07-14merge revision(s) b42afa1dbcbb91e89852b3b3bc72484d7f0a5528, ↵Takashi Kokubun
f1f0cc14cc7d3f9be35b203e5583f9224b1e2387, 543e3a1896ae2fe3b5b954f6497d261ab5663a15, ed2806117a0b76e4439ce1a061fae21d9e116d69, 46e4c8673747de96838d2c5dec37446d23d99d88: [Backport #21500] Suppress gcc 15 unterminated-string-initialization warnings Separate `__has_attribute` from `defined(__has_attribute)` Fix Visual C warnings: ``` regenc.h(121): warning C4067: unexpected tokens following preprocessor directive - expected a newline ``` Cast up `int` instruction code to `VALUE` Fix Visual C warnings: ``` iseq.c(3793): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size iseq.c(3794): warning C4312: 'type cast': conversion from 'int' to 'void *' of greater size ``` Do not let files depend on a phony target Detect `clock_gettime` and `clock_getres` for winpthreads
2025-05-13merge revision(s) 3e47e7a499acd256be549935fcb559d3c82e556c, ↵Takashi Kokubun
b48b841378f80e16378ceb83f3b78e52df9ae023, 2fe8b9cd3d308d754f3d33a948dfb1dd782a10dc: [Backport #21327] Fix redefinition of `clock_gettime` and `clock_getres` winpthreads-git 12.0.0.r720 provides `clock_gettime` and `clock_getres` as inline functions. digest.so needs ruby/digest.h which is installed by build-ext Copy to path with the base name
2024-12-22Split `modular-gc` into build and installationNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12428
2024-12-22Allow variables in modular_gc_dirNobuyoshi Nakada
Such as `$(ruby_version)`, `$(arch)` and so on. Notes: Merged: https://github.com/ruby/ruby/pull/12428
2024-12-10Split system dependent commands to clean modular-gcNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12300
2024-12-05Standardize on the name "modular GC"Peter Zhu
We have name fragmentation for this feature, including "shared GC", "modular GC", and "external GC". This commit standardizes the feature name to "modular GC" and the implementation to "GC library". Notes: Merged: https://github.com/ruby/ruby/pull/12261
2024-11-26Shell dependent command should be in Makefile.inNobuyoshi Nakada
As common.mk is used by nmake.exe, the commands there need to be accepted also by cmd.exe. Notes: Merged: https://github.com/ruby/ruby/pull/12166
2024-10-11Remove unused PRELOADENV macro in ruby-runner.hPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11871
2024-10-11Remove unused SOEXT macro in ruby-runner.hPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11871
2024-10-08Substitute `coroutine_transfer` with prefixed symbol in MakefileNobuyoshi Nakada
``` coroutine/arm64/Context.S:31:57: error: invoking macro TOKEN_PASTE argument 1: empty macro arguments are undefined in ISO C90 [-Wpedantic] 31 | .global PREFIXED_SYMBOL(SYMBOL_PREFIX,coroutine_transfer) | ^ ```
2024-10-07Make rbconfig/sizeof keys US-ASCIINobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11815
2024-10-07Make rbconfig/sizeof keys as literalsNobuyoshi Nakada
These keys are made from string literals, and used only as keys of hashes. Notes: Merged: https://github.com/ruby/ruby/pull/11814
2024-10-03fake.rb: Copy options in RUBY_DESCRIPTION to the fake stringNobuyoshi Nakada
The `RUBY_DESCRIPTION_WITH` macro has been removed already, so there are no more descriptions strings with rjit/yjit enabled. Notes: Merged: https://github.com/ruby/ruby/pull/11766
2024-09-29Remove leading spaces from `LIBPATHFLAG` and `RPATHFLAG`Nobuyoshi Nakada
Join with a space in `MakeMakefile#libpathflag` instead. Notes: Merged: https://github.com/ruby/ruby/pull/11724
2024-09-11Clean up clean only extensionsNobuyoshi Nakada
The clean targets should clean up all extensions, including those have nothing to build for any reason, e.g., platform requirements etc. Notes: Merged: https://github.com/ruby/ruby/pull/11588
2024-09-11Fix duplicate dependency linesNobuyoshi Nakada
exts.mk should deal with cleanings of extensions, including bundled gems. Notes: Merged: https://github.com/ruby/ruby/pull/11588
2024-09-08Fix prelude to use IBFNobuyoshi Nakada
Since universal-parser and prism support, prelude code used functions inaccessible from outside libruby shared library. ``` linking goruby /usr/bin/ld: goruby.o: in function `prelude_eval': /home/runner/work/ruby/ruby/build/golf_prelude.c:221: undefined reference to `rb_ruby_prism_ptr' /usr/bin/ld: goruby.o: in function `pm_prelude_load': /home/runner/work/ruby/ruby/build/golf_prelude.c:192: undefined reference to `pm_options_line_set' /usr/bin/ld: /home/runner/work/ruby/ruby/build/golf_prelude.c:193: undefined reference to `pm_parse_string' /usr/bin/ld: goruby.o: in function `prelude_eval': /home/runner/work/ruby/ruby/build/golf_prelude.c:224: undefined reference to `pm_iseq_new_with_opt' /usr/bin/ld: /home/runner/work/ruby/ruby/build/golf_prelude.c:226: undefined reference to `pm_parse_result_free' /usr/bin/ld: goruby.o: in function `prelude_ast_value': /home/runner/work/ruby/ruby/build/golf_prelude.c:181: undefined reference to `rb_ruby_ast_data_get' /usr/bin/ld: goruby.o: in function `prelude_eval': /home/runner/work/ruby/ruby/build/golf_prelude.c:231: undefined reference to `rb_ruby_ast_data_get' /usr/bin/ld: goruby.o: in function `pm_prelude_load': /home/runner/work/ruby/ruby/build/golf_prelude.c:196: undefined reference to `pm_parse_result_free' collect2: error: ld returned 1 exit status ```
2024-09-08Extract `rb_builtin_find`Nobuyoshi Nakada
Refactor out the same code from `rb_builtin_ast_value` and `pm_builtin_ast_value.
2024-08-29[PRISM] Handle RubyVM.keep_script_linesKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11501
2024-07-15[DOC] Document RbConfig::SIZEOFAlan Wu
2024-07-15[DOC] Document RbConfig::LIMITSAlan Wu
2024-07-15Refactor so RDoc picks up RbConfig::{SIZEOF,LIMITS}Alan Wu
2024-07-11Fix Makefile.in for non GNUmakePeter Zhu
On OpenBSD the Makefile errors with: Using $< in a non-suffix rule context is a GNUmake idiom
2024-07-11Rename gc/gc_impl.c to gc/default.cPeter Zhu
Changing the name makes it clear that this is the default GC in Ruby.
2024-07-11Move gc_impl.c to gc/gc_impl.cPeter Zhu
This commit creates a new directory `gc` to put different GC implementations and moves the default GC from gc_impl.c to gc/gc_impl.c. The default GC can be easily switched using the `BUILTIN_GC` variable in Makefile.in.
2024-07-08Add make target shared-gcPeter Zhu
Allows building shared GC using `make shared-gc SHARED_GC=gc_impl`
2024-07-07Also export CC for dtrace's benefit as wellKJ Tsanaktsidis
The CFLAGS might contain flags that only work with the specified CC
2024-07-07Ensure CFLAGS are passed to probes.o generationKJ Tsanaktsidis
The dtrace python script from systemtap on Linux actually looks at the CFLAGS environment variable when invoking gcc to make the probes.o file. If we don't pass the CFLAGS we're using, this probes.o file can wind up without the required annotations indicating that it supports e.g. Intel CET. Fix this by explicitly exporting our build flags to the environment for this script. [Bug #18061]
2024-07-07Remove $(ASFLAGS) from build system and assemble with $(CFLAGS) insteadKJ Tsanaktsidis
We already assemble our assembly files using the $(CC) compiler driver, rather than the actual $(AS) assembler. This means that * The C preprocessor gets run on the assembly file * It's valid to pass gcc-style flags to it, like e.g. -mbranch-protection or -fcf-protection * If you do so, the relevant preprocessor macros like __CET__ get set * If you really wanted to pass assembler flags, you would need to do that using -Wa,... anyway So I think it makes sense to pass "$(XCFLAGS) $(CFLAGS) $(CPPFLAGS)" to gcc/clang/etc when assembling, rather than passing $(ASFLAGS) (since the flags are not actually passed to `as`, but `cc`!). The side effect of this is that if there are mitigation flags like -fcf-protection in $CFLAGS, then the relevant macros like __CET__ will be defined when assembling the files. [Bug #20601]
2024-06-24Use gperf 3.1 to generate ANSI-C codeNobuyoshi Nakada
2024-06-11Extract hardening CFLAGS to a special $hardenflags variableKJ Tsanaktsidis
This changes the automatic detection of -fstack-protector, -D_FORTIFY_SOURCE, and -mbranch-protection to write to $hardenflags instead of $XCFLAGS. The definition of $cflags is changed to "$hardenflags $orig_cflags $optflags $debugflags $warnflags" to match. Furthermore, these flags are _prepended_ to $hardenflags, rather than appended. The implications of doing this are as follows: * If a CRuby builder specifies cflags="-mbranch-protection=foobar" at the ./configure script, and the configure script detects that -mbranch-protection=pac-ret is accepted, then GCC will be invoked as "gcc -mbranch-protection=pac-ret -mbranch-protection=foobar". Since the last flags take precedence, that means that user-supplied values of these flags in $cflags will take priority. * Likewise, if a CRuby builder explicitly specifies "hardenflags=-mbranch-protection=foobar", because we _prepend_ to $hardenflags in our autoconf script, we will still invoke GCC as "gcc -mbranch-protection=pac-ret -mbranch-protection=foobar". * If a CRuby builder specifies CFLAGS="..." at the configure line, automatic detection of hardening flags is ignored as before. * C extensions will _also_ be built with hardening flags now as well (this was not the case by default before because the detected flags went into $XCFLAGS). Additionally, as part of this work, I changed how the detection of PAC/BTI in Context.S works. Rather than appending the autodetected option to ASFLAGS, we simply compile a set of test programs with the actual CFLAGS in use to determine what PAC/BTI settings were actually chosen by the builder. Context.S is made aware of these choices through some custom macros. The result of this work is that: * Ruby will continue to choose some sensible defaults for hardening options for the C compiler * Distributors are able to specify CFLAGS that are consistent with their distribution and override these defaults * Context.S will react to whatever -mbranch-protection is actually in use, not what was autodetected * Extensions get built with hardening flags too. [Bug #20154] [Bug #20520]
2024-06-02Add `nightly` recipeNobuyoshi Nakada
Installs the last revision in the previous `RUBY_RELEASE_DATE`.
2024-05-30[PRISM] Support for compiling builtinsKevin Newton
2024-05-26Fix macos bug deleting too many fileseileencodes
Since #10209 we've been noticing that on macos after running `make clean` the `coroutine/arm64/Context.S` file is missing, causing subsequent make calls to fail because `Context.S` is needed to build `Context.o`. The reason this is happening is because macos is case-insensitive so the `.s` looks for `coroutine/arm64/Context.s` and finds `coroutine/arm64/Context.s`. This does not happen on linux because the filesystem is case sensitive. I attempted to use `find` because it is case sensitive regardless of filesystem, but it was a lot slower than `rm` since we can't pass multiple file names the same way to `find`. Reverting this small part of #10209 fixes the issue for macos and it wasn't clear that those changes were strictly necessary for the rest of the PR. We changed the original code to use `rm` instead of `delete` because it is not standarized on POSIX.
2024-05-09test-syntax-suggest is not working with mswin environmentHiroshi SHIBATA
2024-05-03Rename `vast` to `ast_value`yui-knk
There is an English word "vast". This commit changes the name to be more clear name to avoid confusion.
2024-04-26[Universal parser] Decouple IMEMO from rb_ast_tHASUMI Hitoshi
This patch removes the `VALUE flags` member from the `rb_ast_t` structure making `rb_ast_t` no longer an IMEMO object. ## Background We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby. To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE. ## Summary (file by file) - `rubyparser.h` - Remove the `VALUE flags` member from `rb_ast_t` - `ruby_parser.c` and `internal/ruby_parser.h` - Use TypedData_Make_Struct VALUE which wraps `rb_ast_t` `in ast_alloc()` so that GC can manage it - You can retrieve `rb_ast_t` from the VALUE by `rb_ruby_ast_data_get()` - Change the return type of `rb_parser_compile_XXXX()` functions from `rb_ast_t *` to `VALUE` - rb_ruby_ast_new() which internally `calls ast_alloc()` is to create VALUE vast outside ruby_parser.c - `iseq.c` and `vm_core.h` - Amend the first parameter of `rb_iseq_new_XXXX()` functions from `rb_ast_body_t *` to `VALUE` - This keeps the VALUE of AST on the machine stack to prevent being removed by GC - `ast.c` - Almost all change is replacement `rb_ast_t *ast` with `VALUE vast` (sorry for the big diff) - Fix `node_memsize()` - Now it includes `rb_ast_local_table_link`, `tokens` and script_lines - `compile.c`, `load.c`, `node.c`, `parse.y`, `proc.c`, `ruby.c`, `template/prelude.c.tmpl`, `vm.c` and `vm_eval.c` - Follow-up due to the above changes - `imemo.{c|h}` - If an object with `imemo_ast` appears, considers it a bug Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-04-15[Universal parser] DeVALUE of p->debug_lines and ast->body.script_linesHASUMI Hitoshi
This patch is part of universal parser work. ## Summary - Decouple VALUE from members below: - `(struct parser_params *)->debug_lines` - `(rb_ast_t *)->body.script_lines` - Instead, they are now `rb_parser_ary_t *` - They can also be a `(VALUE)FIXNUM` as before to hold line count - `ISEQ_BODY(iseq)->variable.script_lines` remains VALUE - In order to do this, - Add `VALUE script_lines` param to `rb_iseq_new_with_opt()` - Introduce `rb_parser_build_script_lines_from()` to convert `rb_parser_ary_t *` into `VALUE` ## Other details - Extend `rb_parser_ary_t *`. It previously could only store `rb_parser_ast_token *`, now can store script_lines, too - Change tactics of building the top-level `SCRIPT_LINES__` in `yycompile0()` - Before: While parsing, each line of the script is added to `SCRIPT_LINES__[path]` - After: After `yyparse(p)`, `SCRIPT_LINES__[path]` will be built from `p->debug_lines` - Remove the second parameter of `rb_parser_set_script_lines()` to make it simple - Introduce `script_lines_free()` to be called from `rb_ast_free()` because the GC no longer takes care of the script_lines - Introduce `rb_parser_string_deep_copy()` in parse.y to maintain script_lines when `rb_ruby_parser_free()` called - With regard to this, please see *Future tasks* below ## Future tasks - Decouple IMEMO from `rb_ast_t *` - This lifts the five-members-restriction of Ruby object, - So we will be able to move the ownership of the `lex.string_buffer` from parser to AST - Then we remove `rb_parser_string_deep_copy()` to make the whole thing simple
2024-04-11Realclean extracted bundled gems and lock filesNobuyoshi Nakada
2024-04-11Cleanings of .bundle do not need cleanings of extNobuyoshi Nakada
2024-03-24Remove never used macros related to RJIT [ci skip]Nobuyoshi Nakada
These macros have not been used since the commit "Stop exporting symbols for MJIT" 233ddfac541749a0da80ea27913dc1ef4ea700bb, and renamed as RJIT.
2024-03-19[DOC] Unify Doxygen formats (#10285)Takashi Kokubun
2024-03-17Refactor encdb and transdb templatesNobuyoshi Nakada
- Simplify globbed file names. - Prefer `File.open` over `Kernel#open`. - Swallow initializer blocks instead of line by line with flip-flop. - Re-structure converter list.
2024-03-17Revert "Remove flip-flop usages from build scripts"Nobuyoshi Nakada
This reverts commit 301fa452f7a9cdea922103e9c50d85a2d5652d0d.
2024-03-11Ignore failures on removing ext sub directoriesNobuyoshi Nakada
When multiple libraries exist in a subdirectory under `ext`, `rmdir -p` may fail, because other directories have not been removed yet or the parent directory has been removed by other `distclean`. `rmdir` in GNU coreutils has `--ignore-fail-on-non-empty` option for the former case but others may not, and the latter race condition is not avoidable anyway.
2024-03-10Clean intermediate files and debug info for each targetNobuyoshi Nakada
By replacing `ALLOBJS` suffix with intermediate file suffixes instead of roughly removing by wildcards. Made `cleanlibs` append `.dSYM` suffix for each word in `TARGET_SO`, not the end of the entire list.
2024-03-08Remove duplicate dependency lineNobuyoshi Nakada
2024-03-07Clean up files made by runnable in clean-runnable [ci skip]Nobuyoshi Nakada