Граф коммитов

532 Коммитов

Автор SHA1 Сообщение Дата
Alan Wu 1015e69d37
YJIT: echo "\n" is not portable
It's unspecified by POSIX. zsh and dash give a newline and
bash doesn't substitute it. Attributes don't have to be
followed by a newline anyway, so just remove it.

[Bug #19174]
2022-12-02 12:24:17 -05:00
Nobuyoshi Nakada a5dde619a4
Fix up "Avoid bash specific variable substitution"
Keep `target_alias` empty if it is set to empty.  If it is set to non
empty, `os_version_style_transform` is not used.
2022-12-03 02:03:57 +09:00
Nobuyoshi Nakada eb6785356d Avoid bash specific variable substitution
It may cause parse errors in some other sh even in never executed
parts.
2022-12-02 23:45:43 +09:00
Alan Wu a81c89b7c8
YJIT: Make sure rustc's target matches before enabling (#6804)
For people using Rosetta 2 on ARM Macs, it can happen that the
rustc in the PATH compiles for x86_64 while clang is targeting
ARM. We were enabling YJIT in these situations because the test
program compiled fine, but caused linking failure later due to
the architecture mismatch.

Adjust the test program to fail when rustc's target arch is different
from ruby's target arch.

[Bug #19146]
2022-11-24 14:58:41 -05:00
Takashi Kokubun 3071a727e0
Add a comment about confusing code [ci skip] 2022-11-20 23:21:28 -08:00
Samuel Williams ea8a7287e2
Add support for `sockaddr_un` on Windows. (#6513)
* 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>
2022-11-17 14:50:25 -08:00
Takashi Kokubun 05af417587
YJIT: Show YJIT build option in RUBY_DESCRIPTION (#6738)
YJIT: Show YJIT profile in RUBY_DESCRIPTION
2022-11-16 10:08:52 -08:00
Takashi Kokubun d905632851
Define YJIT_STATS on --enable-yjit=stats (#6710) 2022-11-10 13:16:25 -08:00
Alan Wu c771d83593
Set up EXTSTATIC before checking it
The bundle_loader check for darwin checks EXTSTATIC, but previously the
setup for the variable comes after the check. I had trouble building
using --with-static-linked-ext on darwin before this change.
2022-11-10 11:30:54 -05:00
Alan Wu 1466682a23
YJIT: Improve checking message for rustc version (#6693)
Preivously we didn't have a "checking ...." line for this check and when
rustc was too old, we would dump the error message to the console like:

    checking for rustc... rustc
    error: there is no argument named `x`
     --> <anon>:1:33
      |
    1 | fn main() { let x = 1; format!("{x}"); }
      |                                 ^^^

    error: aborting due to previous error

`configure` checks usually don't do this and this might be confusing.

With this commit it now says something like:

    checking whether rustc is new enough for YJIT... no
2022-11-08 15:29:30 -05:00
Maxime Chevalier-Boisvert 3703a81491
YJIT: improve/fix code to automatically build YJIT when available (#6684)
* YJIT: improve/fix code to automatically build YJIT when available

* Set YJIT_SUPPORT=no

* Fix rustc => $RUSTC
2022-11-08 11:57:11 -05:00
Nobuyoshi Nakada fc842c9ccc
Check `rustc` with the target 2022-11-06 19:32:50 +09:00
Nobuyoshi Nakada 9627aab825
`--disable-jit-support` should disable YJIT successfully
Even if `rustc` is available, it should not be an error unless
`--enable-yjit` is explicitly given.
2022-11-06 17:07:44 +09:00
Nobuyoshi Nakada cb899a990a
Disable YJIT support when cross-compiling
As the target-list of `rustc` is different from `config.guess` and
`config.sub`, `$target` cannot be used directly.
2022-11-06 10:16:12 +09:00
Nobuyoshi Nakada 1454f8f219 Add `--target` option to RUSTC when cross-compiling 2022-11-06 06:47:38 +09:00
Nobuyoshi Nakada 10fd1d9507 Should use the configured rustc consistently 2022-11-06 06:47:38 +09:00
Maxime Chevalier-Boisvert dd4ae9a475
Auto-enable YJIT build when rustc >= 1.58.0 present (#6662)
* Auto-enable YJIT build when rustc >= 1.58.0 present

* Try different incantation to have rustc output to stdout only

* Add comment, remove whitespace

* Try to detect if we are on a platform on which YJIT is supported
2022-11-04 17:02:04 -04:00
Nobuyoshi Nakada 0717cb8419
Try -fstack-protector-strong on MinGW
The CI for MinGW has used it.
2022-10-30 19:16:09 +09:00
Nobuyoshi Nakada c5ca250eb5
Clear `_FORTIFY_SOURCE` before definition
As clang on macOS defines this macro as 0 internally when a sanitizer
option is given, clear it before definition to suppress redefinition
warnings.
2022-10-29 16:17:45 +09:00
Alan Wu 5ca23caa20
YJIT: fold the "asm_comments" feature into "disasm" (#6591)
Previously, enabling only "disasm" didn't actually build. Since these
two features are closely related and we don't really use one without the
other, let's simplify and merge the two features together.
2022-10-19 14:03:07 -04:00
Sergey Fedorov 567725ed30
Fix and improve coroutines for Darwin (macOS) ppc/ppc64. (#5975) 2022-10-19 23:49:45 +13:00
Nobuyoshi Nakada ee6cc25026
Remove wrong dollar 2022-10-15 01:03:47 +09:00
Nobuyoshi Nakada f3a3ab110e
[Bug #16909] Honor the tool prefix against pkg-config 2022-10-02 16:08:38 +09:00
Maxime Chevalier-Boisvert 8fcbb79742
YJIT: reverse configure.ac changes that disable `--yjit-stats` on Graviton1 (#6457)
Reverse configure.ac changes that disable YJIT stats on Graviton1
2022-09-27 19:27:19 -04:00
Nobuyoshi Nakada ecffc6a203 Generate the revision.h before Makefile
Except for GNU make which updates makefiles automatically, repeating
configure in the same directory causes `make` to stop whenever pulled
a new commit.  This is unexpected in CIs.
2022-09-26 13:03:23 +09:00
Nobuyoshi Nakada dc7d929e54
Extract `RUBY_RELEASE_DATE` from also revision.h
This make variable is very useful for daily build.
2022-09-25 22:40:05 +09:00
Takashi Kokubun 912ea8257a
YJIT: Support Rust 1.58.1 for --yjit-stats on Arm (#6410)
* YJIT: Test Rust 1.58.1 as well on Cirrus

* YJIT: Avoid using a Rust 1.60.0 feature

* YJIT: Use autoconf to detect support

* YJIT: We actually need to run it

for checking it properly

* YJIT: Try cfg!(target_feature = "lse")

* Revert "YJIT: Try cfg!(target_feature = "lse")"

This reverts commit 4e2a9ca9a9c83052c23b5e205c91bdf79e88342e.

* YJIT: Add --features stats only when it works

* Update configure.ac

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
2022-09-23 16:17:54 -04:00
Jeremy Evans 88bf8ad6e9 Allow --enable-yjit on OpenBSD
yjit uses _Unwind_* functions from libunwind.  These functions
are available in libc++abi (which requires libpthread), so
add those to LDFLAGS if enabling yjit on OpenBSD.
2022-09-23 05:51:34 +09:00
Alan Wu a8dc49b4d5 YJIT: Support MAKE=bmake for release build
This add support for bmake, which should allow building with
`configure --enable-yjit` for the BSDs. Tested on FreeBSD 13 and
on macOS with `configure MAKE=bmake` on a case-sensitive file system.

It works by including a fragment into the Makefile through the configure
script, similar to common.mk. It uses the always rebuild approach to
keep build system changes minimal.
2022-09-20 14:17:27 -04:00
Nobuyoshi Nakada 6898984f1c
[Bug #19005] dynamic_lookup linker option in external libraries
The warning against `-undefined dynamic_lookup` is just a warning yet,
and many gems seem to pay no attention to warnings.  Until it fails
actually, keep it as a migration path, except for standard extension
libraries and bundled extension gems.
2022-09-17 12:09:34 +09:00
Kenta Murata 2e25b85a7e
configure.ac: Apply suggestions from code review in #6366
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-09-14 23:14:36 +09:00
Kenta Murata f512df7398
configure.ac: Add --with-gmp-dir (#6366)
Add the `--with-gmp-dir` to specify the prefix directory of GMP.
The`--without-gmp` option is preserved for convenience.  It can
be used to force to reject using GMP even if the `--with-gmp-dir`
option is specified.
2022-09-14 22:17:39 +09:00
Nobuyoshi Nakada c428fc0e1f -undefined dynamic_lookup is obsolete 2022-09-14 11:27:05 +09:00
Nobuyoshi Nakada e2b47b832f
configure.ac: Manage OPT_DIR better (#6367)
* Check rpath flag earlier

* Manage OPT_DIR at once
2022-09-14 10:42:38 +09:00
Nobuyoshi Nakada ed029e9bd4
Autoconf 2.70 or AC_PROG_CC_C99 for earlier is checking for C99
It is no longer necessary to add it to `CFLAGS`/`CPPFLAGS` later.

Furthermore, as `CPPFLAGS` is used also with C++ compiler, the option
particular to C such as `-std=gnu99` results in an error.
2022-09-12 19:53:10 +09:00
Nobuyoshi Nakada 1f91dcdab3
Define BOOTSTRAPRUBY from HAVE_BASERUBY 2022-09-07 14:33:25 +09:00
Nobuyoshi Nakada 3a575d13d5
Ensure BASERUBY when cross-compiling 2022-09-07 10:08:23 +09:00
Takashi Kokubun cb26917d1c
Drop Solaris support for MJIT
I tried to debug:
http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20220905T070005Z.fail.html.gz
but I don't have sudo privilege to install dependencies such as xz on
that machine. Thus I can't extract a prebuilt libclang binary.

Anyway, if we find out ABI is different from x86_64 / aarch64, we'd like
to have sparc CI associated to GitHub to run `make mjit-bindgen`, but we
can't. Supporting this could be too hard, so I'm leaving it for now.
2022-09-05 01:25:00 -07:00
Nobuyoshi Nakada a01271c1c4
BOOTSTRAPRUBY needs fake.rb when cross-compiling 2022-09-03 21:37:24 +09:00
Nobuyoshi Nakada 7c67d0fd79
Make sources by BASERUBY if available instead of miniruby 2022-09-03 19:25:29 +09:00
Nobuyoshi Nakada 6f5305e0d2
Exclude LIBPATHENV wrapper from PREP 2022-09-03 19:20:03 +09:00
Nobuyoshi Nakada 21a5da3c4c
Check if MSys shell can run a command with a drive letter 2022-09-03 19:20:03 +09:00
Nobuyoshi Nakada cd1a0b3caa Stop defining `RUBY_ABI_VERSION` if released versions
As commented in include/ruby/internal/abi.h, since teeny versions of
Ruby should guarantee ABI compatibility, `RUBY_ABI_VERSION` has no role
in released versions of Ruby.
2022-08-12 15:57:25 +09:00
Nobuyoshi Nakada 74d95744bd
Add `--enable-devel` configure option
Since `RUBY_DEVEL` in cppflags has no effect in the configure script
and makefiles.
2022-08-11 11:34:52 +09:00
Jeremy Evans 357352af5e Do not enable RUBY_DEVEL by RUBY_PATCHLEVEL
This makes RUBY_DEVEL not enabled automatically.  It still can be
enabled manually.

Test manually using RUBY_DEVEL in CI.

Implements [Feature #17468]
2022-08-09 22:13:17 -07:00
Yuta Saito 184fd94d7e Resolve abi symbols from libruby.dylib when available 2022-08-04 16:29:22 +09:00
Yuta Saito 6d8b9a9d61 Resolve abi symbol references from miniruby to avoid circular deps
Adding `ruby` to `PREP` causes the following circular dependencies
because `PREP` is used as a prerequisite by some targets required to
build `ruby` target itself.
```
make: Circular .rbconfig.time <- ruby dependency dropped.
make: Circular builtin_binary.inc <- ruby dependency dropped.
make: Circular ext/extinit.c <- ruby dependency dropped.
make: Circular ruby <- ruby dependency dropped.
```

Adding a new Make variable like `EXTPREP` only for exts may be also
reasonable, but it would introduce another complexity into our build
system. `-bundle_loader` doesn't care that link-time and run-time
loader executables are different as long as bound symbols are provided,
so it's ok to resolve from miniruby to simplify our build.
2022-08-04 16:29:22 +09:00
Alan Wu c69582a540 Quote $(BUILTRUBY) so paths with spaces work 2022-08-04 16:29:22 +09:00
Yuta Saito 50d81bfbc1 Link ext bundles with bundle loader option for newer ld64
ld64 shipped with Xcode 14 emits a warning when using `-undefined
dynamic_lookup`.

```
ld: warning: -undefined dynamic_lookup may not work with chained fixups
```

Actually, `-undefined dynamic_lookup` doesn't work when:

1. Link a *shared library* with the option
2. Link it with a program that uses the chained-fixup introduced from
   macOS 12 and iOS 15
because `-undefined dynamic_lookup` uses lazy-bindings and they won't be
bound while dyld fixes-up by traversing chained-fixup info.

However, we build exts as *bundles* and they are loaded only through
`dlopen`, so it's safe to use `-undefined dynamic_lookup` in theory.
So the warning produced by ld64 is false-positive, and it results
failure of option checking in configuration. Therefore, it would be an
option to ignore the warning during our configuration.

On the other hand, `-undefined dynamic_lookup` is already deprecated on
all darwin platforms except for macOS, so it's good time to get rid of
the option. ld64 also provides `-bundle_loader <executable>` option,
which allows to resolve symbols defined in the executable symtab while
linking. It behaves almost the same with `-undefined dynamic_lookup`,
but it makes the following changes:

1. Require that unresolved symbols among input objects must be defined
   in the executable.
2. Lazy symbol binding will lookup only the symtab of the bundle loader
   executable. (`-undefined dynamic_lookup` lookups all symtab as flat
   namespace)

This patch adds `-bundle_loader $(RUBY)` when non-EXTSTATIC
configuration by assuming ruby executable can be linked before building
exts.

See "New Features" subsection under "Linking" section for chained fixup
https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes
2022-08-04 16:29:22 +09:00
John Hawthorn 0e85586ecc Add --enable-yjit=dev_nodebug configure option 2022-07-29 16:32:14 -07:00
John Hawthorn fbd24793cb Add --enable-yjit=stats configure option 2022-07-29 16:32:14 -07:00
Jeremy Evans 2725c5dbe0 Fix invalid mkdir detection on OpenBSD
This was broken by 67e54ce408, which
resulted in " -d" being used as the mkdir_p program. I think this
is because $ac_install_sh has been set to '' at the point it is
used.

There's probably a better way to fix this, but this should allow
the OpenBSD CI to continue to work until a better fix is in place.
2022-07-08 21:08:19 -07: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 fc8020c68e
[Bug #18879] Fix macOS version detections
macOS's AvailabilityMacros.h does not contain macros for future
versions.  If a version macro is not defined, consider only earlier
versions to be targeted.
2022-06-27 01:08:46 +09:00
Nobuyoshi Nakada ec5c56412f [Feature #18839] Drop support for gcc 3 [ci skip] 2022-06-20 12:11:41 +09:00
Nobuyoshi Nakada e711711539
Show gcc version if too old, and move to GCC block [ci skip] 2022-06-18 13:40:46 +09:00
Nobuyoshi Nakada e77d2c296e
Disable maybe-uninitialized warning for gcc 4
It often shows false positive warnings (at least in 4.8).  Newer
versions work well and we can check correct warnings.
2022-06-18 13:15:02 +09:00
KJ Tsanaktsidis 05ffc037ad Disable Mach exception handlers when read barriers in place
The GC compaction mechanism implements a kind of read barrier by marking
some (OS) pages as unreadable, and installing a SIGBUS/SIGSEGV handler
to detect when they're accessed and invalidate an attempt to move the
object.

Unfortunately, when a debugger is attached to the Ruby interpreter on
Mac OS, the debugger will trap the EXC_BAD_ACCES mach exception before
the runtime can transform that into a SIGBUS signal and dispatch it.
Thus, execution gets stuck; any attempt to continue from the debugger
re-executes the line that caused the exception and no forward progress
can be made.

This makes it impossible to debug either the Ruby interpreter or a C
extension whilst compaction is in use.

To fix this, we disable the EXC_BAD_ACCESS handler when installing the
SIGBUS/SIGSEGV handlers, and re-enable them once the compaction is done.
The debugger will still trap on the attempt to read the bad page, but it
will be trapping the SIGBUS signal, rather than the EXC_BAD_ACCESS mach
exception. It's possible to continue from this in the debugger, which
invokes the signal handler and allows forward progress to be made.
2022-06-18 00:10:16 +09:00
Jeremiah Gowdy 1dfe007e16 Update configure.ac
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-06-17 11:58:10 +09:00
Jeremiah Gowdy f3b54d5fc2 Add branch protection to aarch64 targets 2022-06-17 11:58:10 +09:00
Takashi Kokubun f8502a2699
Drop MinGW support of MJIT (#6012)
[Feature #18824]
2022-06-13 09:28:28 -07:00
Nobuyoshi Nakada a56a7119ac
Remove useless assignment always overridden 2022-06-06 11:30:26 +09:00
nick evans d8790ecd04
Export RbConfig::CONFIG["COROUTINE_TYPE"]
THREAD_MODEL is exported already, so this matches that.  Exporting this
is simpler than inspecting configure_args and arch and matching that up
with a specific configure.ac.

Fix GH-5976
2022-06-06 11:30:13 +09:00
Nobuyoshi Nakada 218e8bdcb0
Disable usage of TLS unless available
Thread-local storage is supported since Mac OS X 10.7.  Enable TLS
only when the target version is enough.
2022-05-22 16:49:48 +09:00
Nobuyoshi Nakada e79983a448
Check if thread-local storage is supported on macOS
We need thread-local storage on Clang, since 319afed20f.
2022-05-22 15:26:42 +09:00
Sergey Fedorov 539459abda
Ruby31: add support for Darwin ppc/ppc64 (#5927)
* add coroutines for ppc & ppc64

* fix universal coroutine to include ppc & ppc64

* add powerpc*-darwin to configure.ac

* fix thread_pthread for older systems
2022-05-22 15:02:03 +12:00
Jun Aruga 019cbded90 mkmf: Add a configure option to set verbose mode (V=1 or 0) in mkmf.rb.
Note this change is only for `configure.ac`, not for Windows using
`win32/configure.bat`.

```
$ ./configure --help | grep mkmf
  --enable-mkmf-verbose   enable verbose in mkmf
```

Run the following command to enable the mkmf verbose mode.

```
$ ./configure --enable-mkmf-verbose
$ grep MKMF_VERBOSE config.status
S["MKMF_VERBOSE"]="1"
```

In this mkmf verbose mode, when compiling a native extension, the
`rake compile` prints the compiling commands such as
"gcc -I. <...> path/to/file" instead of "compiling path/to/file".

```
$ git clone https://github.com/deivid-rodriguez/byebug.git
$ cd byebug
$ bundle install --standalone
$ bundle exec rake compile
...
gcc -I. <...> path/to/file
...
```
2022-05-12 12:36:10 +02:00
Nobuyoshi Nakada c7d2247e35
Honor --with-thread option to enable pthread 2022-05-10 09:24:28 +09:00
Aaron Patterson 907b31d7b9 Don't set LDFLAGS by default
This fixes a bug where Ruby on macOS running on ARM would try to look in
`/usr/local/lib` for things to link against, but the libraries in that
directory are from the x86 installation of Homebrew

[ruby-core:108424]
2022-04-28 15:14:45 -07:00
Alan Wu f90549cd38 Rust YJIT
In December 2021, we opened an [issue] to solicit feedback regarding the
porting of the YJIT codebase from C99 to Rust. There were some
reservations, but this project was given the go ahead by Ruby core
developers and Matz. Since then, we have successfully completed the port
of YJIT to Rust.

The new Rust version of YJIT has reached parity with the C version, in
that it passes all the CRuby tests, is able to run all of the YJIT
benchmarks, and performs similarly to the C version (because it works
the same way and largely generates the same machine code). We've even
incorporated some design improvements, such as a more fine-grained
constant invalidation mechanism which we expect will make a big
difference in Ruby on Rails applications.

Because we want to be careful, YJIT is guarded behind a configure
option:

```shell
./configure --enable-yjit # Build YJIT in release mode
./configure --enable-yjit=dev # Build YJIT in dev/debug mode
```

By default, YJIT does not get compiled and cargo/rustc is not required.
If YJIT is built in dev mode, then `cargo` is used to fetch development
dependencies, but when building in release, `cargo` is not required,
only `rustc`. At the moment YJIT requires Rust 1.60.0 or newer.

The YJIT command-line options remain mostly unchanged, and more details
about the build process are documented in `doc/yjit/yjit.md`.

The CI tests have been updated and do not take any more resources than
before.

The development history of the Rust port is available at the following
commit for interested parties:
1fd9573d8b

Our hope is that Rust YJIT will be compiled and included as a part of
system packages and compiled binaries of the Ruby 3.2 release. We do not
anticipate any major problems as Rust is well supported on every
platform which YJIT supports, but to make sure that this process works
smoothly, we would like to reach out to those who take care of building
systems packages before the 3.2 release is shipped and resolve any
issues that may come up.

[issue]: https://bugs.ruby-lang.org/issues/18481

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
Co-authored-by: Noah Gibbs <the.codefolio.guy@gmail.com>
Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2022-04-27 11:00:22 -04:00
S-H-GAMELINKS 5b467400d2 [DOC]Some link prefix replace 2022-04-09 17:43:46 +09:00
S-H-GAMELINKS bff12e1a9a [DOC] Fix comment links 2022-04-07 10:37:52 +09:00
Alan Wu 2222032979
Remove dependency on libcapstone
We have received reports of build failures due to this configuration
check modifying compile flags. Since only YJIT devs use this library
we can remove it to make Ruby easier to build for users.

See: https://github.com/rbenv/ruby-build/discussions/1933
2022-03-31 17:26:28 -04:00
Nobuyoshi Nakada 2cb3efffcf
Extract RUBY_REQUIRE_FUNCS 2022-03-28 16:56:15 +09:00
Nobuyoshi Nakada 7470780058 Check if `__assume` is supported 2022-02-19 23:32:52 +09:00
Nobuyoshi Nakada 131154f878 Define `HAVE___BUILTIN_UNREACHABLE` instead of `UNREACHABLE`
`UNREACHABLE` in ruby/internal/has/builtin.h is only used as just
a flag now, and redefined in ruby/backward/2/assume.h then.
2022-02-19 23:32:52 +09:00
Nobuyoshi Nakada 4113862c00 Do not search for commands with double tool prefixes [Bug #18504]
The `CC` found by `AC_CHECK_TOOL` is prefixed by the host triplet
when cross compiling.  To search for commands with `AC_CHECK_TOOL`
based on that `CC` means to search also doubly prefixed names.
2022-02-17 22:47:02 +09:00
Nobuyoshi Nakada bffd6cbd97
Check if `execv` is available for ruby/missing.h
As MinGW has the declaration, the `dllimport` attribute difference
is warned when compiling missing/*.c without including ruby/win32.h.

```
../src/include/ruby/missing.h:316:17: warning: 'execv' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
  316 | RUBY_EXTERN int execv(const char *, char *const []);
      |                 ^~~~~
```
2022-01-26 18:23:51 +09:00
Nobuyoshi Nakada 4010cbfe35
Use the prefixed pkg-config command 2022-01-26 15:56:22 +09:00
Nobuyoshi Nakada 2c25427496
GCC provides -Wdiv-by-zero 2022-01-22 20:09:56 +09:00
Nobuyoshi Nakada 71bc999009
MinGW also uses `rb_w32_shutdown`
Winsock's `shutdown` is incompatible with the other platforms.
And autoconf fails to detect WINAPI functions on 32bit Windows,
probably due to the argument size suffixes.
2022-01-20 01:18:49 +09:00
Nobuyoshi Nakada 5646f4b67b
Fix a missing comma 2022-01-19 14:46:27 +09:00
Yuta Saito bb2228817f [wasm] configure.ac: disable mjit on wasi by default 2022-01-19 11:19:06 +09:00
Yuta Saito df31fa4a51 [wasm] configure.ac: don't require dup and dup2 only for wasi 2022-01-19 11:19:06 +09:00
Yuta Saito 3794ef6f01 configure.ac: stop overwriting cc wrapper by darwin-cc everytime 2022-01-19 11:19:06 +09:00
Yuta Saito a4b73f1ba8 [wasm] add coroutine/asyncify implementation
set the default coroutine_type as asyncify when wasi
2022-01-19 11:19:06 +09:00
Yuta Saito 7ee786388a [wasm] wasm/missing.{c,h}: add missing libc stubs for wasi-libc 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 e41b121e94 [wasm] configure.ac: setup platform specific libraries
These flags are very wasi-libc version specific, so updating wasi-libc
may break the build. But supporting multiple wasi-libc versions in ruby
doesn't have much benefit because wasi-libc is not installed in most
systems.
2022-01-19 11:19:06 +09:00
Yuta Saito 8a50a6b6f9 [wasm] configure.ac: disable stack-protector
clang does not yet support stack-protector for wasm
2022-01-19 11:19:06 +09:00
Peter Zhu ffda21b7ba [Feature #18491] Drop support for HP-UX
IA64 support was dropped in ticket #15894, so we can drop support for
HP-UX.
2022-01-18 09:52:15 -05:00
Yuta Saito ae51f304d2 io_buffer.c: use mremap based resizing only when mremap available
some libc implementations (e.g. wasi-libc) define MREMAP_MAYMOVE, but
don't have mremap itself, so guard the use of mremap by HAVE_MREMAP
2022-01-07 02:13:19 +09:00
Nobuyoshi Nakada c87c027f18 configure.in: unexpand exec_prefix in includedir
Replace `exec_prefix` in includedir as well as bindir, libdir, and
so on. [Bug #18373]
2021-12-24 19:11:10 +09:00
Nobuyoshi Nakada ec878dac90
Move -ljemalloc to DLDLIBS [Bug #18391]
Set the alternative memory management library only as a platform
specific library, without other libraries.
2021-12-07 15:20:02 +09:00
Naohisa Goto e59f3054c3 Delete #if line during checking madvise() on Solaris
The madvise() declaration should always be compiled on Solaris
to check whether the declaration is good on the environment.
For the purpose, the #if line is unnecessary.
(There was also a trivial typo that the #if was not closed
by #endif and the check always failed with preprocessor error.)
2021-11-30 16:39:31 +09:00
Nobuyoshi Nakada 316caf6b39
Enable load-relative on Solaris 2021-11-30 12:40:02 +09:00
Nobuyoshi Nakada f379748e80
Cache wheather madvise declaration is needed on Solaris 2021-11-30 11:12:21 +09:00
Nobuyoshi Nakada 12fbdf4d4e
Fix conflicting declaration on Solaris
SunC
```
"cont.c", line 24: identifier redeclared: madvise
	current : function(pointer to char, unsigned int, int) returning int
	previous: function(pointer to void, unsigned int, int) returning int : "/usr/include/sys/mman.h", line 232
```

GCC
```
cont.c:24:12: error: conflicting types for 'madvise'
   24 | extern int madvise(caddr_t, size_t, int);
      |            ^~~~~~~
In file included from cont.c:16:
/usr/include/sys/mman.h:232:12: note: previous declaration of 'madvise' was here
  232 | extern int madvise(void *, size_t, int);
      |            ^~~~~~~
```
2021-11-30 09:10:58 +09:00
Naohisa Goto 8287d2f23c Workaround for implicit declaration of function 'madvise' on Solaris
On Solaris, madvise(3C) is NOT defined for SUS (XPG4v2) or later,
but MADV_* macros are defined when __EXTENSIONS__ is defined.
This may cause compile error on Solaris 10 with GCC when
"-Werror=implicit-function-declaration" and "-D_XOPEN_SOURCE=600"
are added by configure.
2021-11-30 00:03:04 +09:00
Yusuke Endoh 9fc7ea64a1 configure.ac: don't use shutdown on emscripten
... to absorb a change on Ubuntu 21.10
2021-11-03 14:00:51 +09:00