Commit graph

68 commits

Author SHA1 Message Date
Nobuyoshi Nakada
626037e143
Support RUBY_MODULAR_GC with LOAD_RELATIVE 2024-12-22 22:10:26 +09:00
Peter Zhu
ce1ad1b816 Standardize on the name "modular GC"
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".
2024-12-05 10:33:26 -05:00
Nobuyoshi Nakada
edb1c8215d Add integer overflow check macros for add/sub as well as mul 2024-11-09 00:08:03 +09:00
Peter Zhu
e798f45cc2 Error when --with-shared-gc doesn't specify a directory 2024-07-26 13:20:04 -04:00
Peter Zhu
c1ff8d519f Fix grammar of ruby_shared_gc.m4 2024-07-09 13:14:28 -04:00
Peter Zhu
a9f6bd028a Add make target shared-gc
Allows building shared GC using `make shared-gc SHARED_GC=gc_impl`
2024-07-08 16:47:25 -04:00
Peter Zhu
e2ceded2c6 Change external GC to use directory at configure
This commit changes the external GC API to use `--with-shared-gc=DIR` at
configure time with a directory of the external GC and uses
`RUBY_GC_LIBRARY` environment variable to load the external GC at
runtime.
2024-07-05 14:05:58 -04:00
Nobuyoshi Nakada
65d3eacc80 No longer needs sigsetjmp
Since signal handlers just set flag and return now, `sigsetjmp` and
`siglongjmp` will not be needed.
2024-06-24 17:38:01 +09:00
KJ Tsanaktsidis
0ccb80d6bf Extract hardening CFLAGS to a special $hardenflags variable
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-11 20:48:55 +10:00
Sorah Fukumori
1ab7c412d2
RUBY_CHECK_HEADER didn't define HAVE_{header-file} (#10876)
--with-gmp is not working at all because HAVE_GMP_H
was missing since 18eaf0be90. [Bug #20515]

bug: https://bugs.ruby-lang.org/issues/20515
follow-up: https://bugs.ruby-lang.org/issues/20494
follow-up: 18eaf0be90
follow-up: https://github.com/ruby/ruby/pull/10805
2024-05-30 18:52:26 +00:00
Nobuyoshi Nakada
18eaf0be90 [Bug #20494] Search non-default directories for GMP
Co-Authored-by: lish82 (Hiroki Katagiri)
2024-05-20 13:54:08 +09:00
Matt Valentine-House
a2ea4ec30c Add --with-shared-gc build flag 2024-04-15 19:50:47 +01:00
Matt Valentine-House
5903fdf43e
[DOC] Fix wheather -> whether typos in configure. 2024-04-02 21:53:56 +09:00
Yuta Saito
02c88477ce [wasm] tool/m4/ruby_wasm_tools.m4: Add default value for OBJCOPY
The tool is used to build shared libraries but system installed
tools usually don't support WebAssembly, so use WASI SDK's tools by default.
2024-02-06 01:08:18 +09:00
Nobuyoshi Nakada
2a4a84664a [Bug #20088] Fix ARCH_FLAG for cross compiling 2023-12-27 19:11:54 +09:00
Nobuyoshi Nakada
4d5bfa7c3b
Ignore the spcial case of target_cpu
On Windows, x86_64 is called as x64.
2023-12-15 15:39:14 +09:00
Nobuyoshi Nakada
2c2c6bc3fa
Fix ARCH_FLAG when cross-compiling on macOS 2023-12-15 15:19:16 +09:00
Nobuyoshi Nakada
1e5c4026d5
Fix ARCH_FLAG when --with-arch with single CPU 2023-12-15 14:10:02 +09:00
Nobuyoshi Nakada
5e24a4e392
Strip universal_archnames 2023-10-21 15:42:41 +09:00
Ben Hamilton
c8bafc3b01 Fix autoconf RUBY_STACK_GROW_DIRECTION on ARM devices 2023-02-26 22:17:24 +09:00
Yuta Saito
afd46429fc tool/m4/ruby_wasm_tools.m4: force passing WASI_SDK_PATH when building for wasi
Make the WASI_SDK_PATH variable mandatory when building for wasi host.
This requirement prevents developers from being stuck due to unfriendly
configuration's error message.
2022-12-21 11:19:23 +09:00
Sergey Fedorov
567725ed30
Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975) 2022-10-19 23:49:45 +13:00
Nobuyoshi Nakada
67e54ce408
Fallback mkdir_p to as_mkdir_p
Assume `mkdir -p` to be race-free on recent systems.
And we do not provide install-sh anyway.
2022-07-07 15:06:10 +09:00
Nobuyoshi Nakada
c7d2247e35
Honor --with-thread option to enable pthread 2022-05-10 09:24:28 +09:00
Nobuyoshi Nakada
8d27d00af5
Fix locations of the second argument 2022-03-30 14:38:33 +09:00
Nobuyoshi Nakada
5568cd5a55
Fix a missing comma 2022-03-28 17:02:02 +09:00
Nobuyoshi Nakada
152bb3c0b4
Use m4 comments outside macros in m4 files 2022-03-28 17:01:28 +09:00
Nobuyoshi Nakada
2cb3efffcf
Extract RUBY_REQUIRE_FUNCS 2022-03-28 16:56:15 +09:00
Nobuyoshi Nakada
2ae35ad766 RUBY_REPLACE_TYPE: check if the target type is a pointer 2022-02-19 15:33:15 +09:00
Nobuyoshi Nakada
355bc37196
Reuse the default AC_LANG_PROGRAM(C) definition 2022-01-23 01:02:11 +09:00
Nobuyoshi Nakada
ad150a1459
Override AC_C_PROGRAM on old autoconf
Autoconf 2.69 fails to detect `-Werror=old-style-definition` due
to the old style definition of `main`.
2022-01-22 20:13:46 +09:00
Yuta Saito
420622b5a7 [wasm] add no thread variant for freestanding environment
This implementation does nothing around preemptive context switching
because there is no native thread.
2022-01-19 11:19:06 +09:00
Yuta Saito
65f95f26ff [wasm] add asyncify based setjmp, fiber, register scan emulation
configure.ac: setup build tools and register objects

main.c: wrap main with rb_wasm_rt_start to handle asyncify unwinds

tool/m4/ruby_wasm_tools.m4: setup default command based on WASI_SDK_PATH
environment variable. checks wasm-opt which is used for asyncify.

tool/wasm-clangw wasm/wasm-opt: a clang wrapper which replaces real
wasm-opt with do-nothing wasm-opt to avoid misoptimization before
asyncify. asyncify is performed at POSTLINK, but clang linker driver
tries to run optimization by wasm-opt unconditionally. inlining pass
at wasm level breaks asyncify's assumption, so should not optimize
before POSTLIK.

wasm/GNUmakefile.in: wasm specific rules to compile objects
2022-01-19 11:19:06 +09:00
Yuta Saito
4e0747a8a2 Allow the thread-model to be switched by configure option
This change adds --with-thread=IMPL option to the configure. If not
supplied, default implementation for each platform will be used.
2021-10-30 10:18:33 +09:00
Yuta Saito
8590d61ea9 Select including thread impl file at config time 2021-10-30 10:18:33 +09:00
Yuta Saito
ccda26efe7 Split thread-model config into another ac file
This is a first step to allow the thread-model implementation to be
switched by configure's option
2021-10-30 10:18:33 +09:00
Nobuyoshi Nakada
0ad3ed5e0e
Checks for CPU specific header on universal build 2021-10-01 20:30:10 +09:00
Nobuyoshi Nakada
c7414f517f
Prefer printf like the recent autoconf 2021-10-01 20:30:10 +09:00
Nobuyoshi Nakada
afd4cfcf22
Try "so" attribute if "smso" is not found 2021-07-06 21:02:40 +09:00
Nobuyoshi Nakada
1f56238032
Remove comments in tool/m4 from the generated configure 2021-04-17 19:14:21 +09:00
Nobuyoshi Nakada
e34eb58ac7
Keep ARCH_OPTION for arm64 2021-01-22 23:40:32 +09:00
Nobuyoshi Nakada
c32375883a
Update for autoconf 2.70 2021-01-18 16:22:17 +09:00
Nobuyoshi Nakada
3b7c05ef8d
Fixed RUBY_RM_RECURSIVE when autoconf met the required version
Before 9189cf5793 the result of
`m4_version_compare` was compared to -1, however the `$2` of
`m4_version_prereq` has different meaning and is expanded when
the required version met.
2020-12-13 01:16:57 +09:00
Samuel Giddins
7cb8904a12 Extract correct processor name for ARM64 Macs 2020-06-30 19:03:50 +09:00
卜部昌平
9e6e39c351
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
2020-04-08 13:28:13 +09:00
Nobuyoshi Nakada
df275179bd
Revert "Moved aclocal.m4 to macro directory"
This reverts commit 4a6571dbc1,
because chkbuild does not follow.
2020-04-05 11:53:07 +09:00
Nobuyoshi Nakada
4a6571dbc1 Moved aclocal.m4 to macro directory 2020-04-05 09:26:57 +09:00
卜部昌平
72bbf60f3a do not assume GCC for __builtin_setjmp
Namely recent Sun C compiler has this function, and is not a GCC.
Meanwhile the code without RUBY_JMP_BUF assumes GCC.  We have to define
the macro when we detect __builtin_setjmp for non-GCC compilers.
2020-02-06 11:46:51 +09:00
Fangrui Song
e006b992c2 typedef rb_jmpbuf_t to void *[5] if __builtin_setjmp is used
The built-in version operates on a buffer of 5 words, much smaller than
the size of jmp_buf defined in libc.
Note, powerpc requires 5 words, while arm and x86_64 just require 3.
2019-09-21 13:24:58 +09:00
Samuel Williams
d17344cfc5 Remove IA64 support. 2019-06-19 23:30:04 +12:00