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

389 Коммитов

Автор SHA1 Сообщение Дата
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
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 5ff47e0c8a Check old-style definitions 2021-10-27 16:28:10 +09:00
Alan Wu 28632ea7ba Mention YJIT in Capstone autoconf check 2021-10-20 18:19:43 -04:00
Aaron Patterson 7efde1bfb4 conditionally add libcapstone 2021-10-20 18:19:27 -04:00
Aaron Patterson e427fdff0a Directly link libcapstone for easier development
This lets us use libcapstone directly from miniruby so we don't need a
Ruby Gem to to dev work.

Example usage:

```ruby
def foo(x)
  if x < 1
    "wow"
  else
    "neat"
  end
end

iseq = RubyVM::InstructionSequence.of(method(:foo))
puts UJIT.disasm(iseq)
100.times { foo 1 }
puts UJIT.disasm(iseq)
```

Then in the terminal

```
$ ./miniruby test.rb

== disasm: #<ISeq:foo@test.rb:1 (1,0)-(7,3)> (catch: FALSE)
local table (size: 1, argc: 1 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] x@0<Arg>
0000 getlocal_WC_0                          x@0                       (   2)[LiCa]
0002 putobject_INT2FIX_1_
0003 opt_lt                                 <calldata!mid:<, argc:1, ARGS_SIMPLE>
0005 branchunless                           10
0007 putstring                              "wow"                     (   3)[Li]
0009 leave                                                            (   7)[Re]
0010 putstring                              "neat"                    (   5)[Li]
0012 leave                                                            (   7)[Re]

== ISEQ RANGE: 10 -> 10 ========================================================
        0x0:    movabs  rax, 0x7fe816e2d1a0
        0xa:    mov     qword ptr [rdi], rax
        0xd:    mov     r8, rax
        0x10:   mov     r9, rax
        0x13:   mov     r11, r12
        0x16:   jmp     qword ptr [rax]
== ISEQ RANGE: 0 -> 7 ==========================================================
        0x0:    mov     rax, qword ptr [rdi + 0x20]
        0x4:    mov     rax, qword ptr [rax - 0x18]
        0x8:    mov     qword ptr [rdx], rax
        0xb:    mov     qword ptr [rdx + 8], 3
        0x13:   movabs  rax, 0x7fe817808200
        0x1d:   test    byte ptr [rax + 0x3e6], 1
        0x24:   jne     0x3ffff7b
        0x2a:   test    byte ptr [rdx], 1
        0x2d:   je      0x3ffff7b
        0x33:   test    byte ptr [rdx + 8], 1
        0x37:   je      0x3ffff7b
        0x3d:   mov     rax, qword ptr [rdx]
        0x40:   cmp     rax, qword ptr [rdx + 8]
        0x44:   movabs  rax, 0
        0x4e:   movabs  rcx, 0x14
        0x58:   cmovl   rax, rcx
        0x5c:   mov     qword ptr [rdx], rax
        0x5f:   test    qword ptr [rdx], -9
        0x66:   jne     0x3ffffd5
```

Make sure to `brew install pkg-config capstone`
2021-10-20 18:19:27 -04:00
David CARLIER dfe944bfbe haiku configure fix (again). 2021-10-18 17:40:19 +09:00
David CARLIER 1831693c1f haiku build update stack overflow check in libroot (haiku's libc) now 2021-10-17 14:00:59 +09:00
Jeremy Evans 06c3e80611 Do not allow configuration where neither static or shared library is installed
Fixes [Bug #18000]
2021-10-08 14:01:54 -09:00
Nobuyoshi Nakada e0ef4899f3 [Win32] Prefer Cryptography Next Generation API
[BCryptGenRandom] is available since Windows Vista / Windows
Server 2008.

Regarding [CryptGenRandom]:
> This API is deprecated. New and existing software should start
> using Cryptography Next Generation APIs. Microsoft may remove
> this API in future releases.

[BCryptGenRandom]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
[CryptGenRandom]: https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom
2021-10-02 21:22:33 +09:00
Nobuyoshi Nakada 0ad3ed5e0e
Checks for CPU specific header on universal build 2021-10-01 20:30:10 +09:00
Nobuyoshi Nakada ca3cc677b3
Define ACTION-IF-UNIVERSAL of `AC_C_BIGENDIAN` [Bug #18156]
As we do not use config.h.in, just define the helper macro
instead.
2021-10-01 10:56:11 +09:00
Nobuyoshi Nakada 912a8dcfc5
Needs `AC_PROG_CC`
Although `AC_PROG_CC_C99` has been obsolete, `AC_PROG_CC` is not
and the latter is necessary not to make C++ compiler mandatory.
2021-09-30 19:22:08 +09:00
Lars Kanis 576b2e64cd MINGW-UCRT: Set CONFIG['arch'] and RUBY_PLATFORM to "x64-mingw-ucrt"
This allows easy differentiation between ABI incompatible platforms like MSWIN64 and MSVCRT-based MINGW32.
This also implicates a distinct rubygem platform which is also "x64-mingw-ucrt".

Although the term "mingw32" is the OS-part for 64 bit systems as well, the "32" is misleading and confusing for many users.
Therefore the new platform string drops the "32" from the OS part to just "mingw".
This conforms to the common practice of windows platform testing per RUBY_PLATFORM=~/mswin|mingw/ .
2021-09-20 00:15:30 +09:00
xtkoba (Tee KOBAYASHI) 637d7288f3 MINGW: More permissive pattern matching for coroutine
Pattern matching for target_os in configure script should be permissive if we consider suffixing something onto "mingw32".
2021-09-20 00:15:30 +09:00
xtkoba (Tee KOBAYASHI) 8bda512878 MINGW: set rb_cv_msvcrt=ucrt and RT_VER=140 when UCRT is used 2021-09-20 00:15:30 +09:00
DC a8fe7c9e2a coroutine enables assembly version for dragonflybsd. 2021-09-13 08:12:15 +12:00
Nobuyoshi Nakada b76ad15ed0
Remove stale DLEXT2
Actually disabled at 181a3a2af5 in
2004,  it has remained in config.status and been carried over to
rbconfig.rb.
2021-09-10 14:51:56 +09:00
Nobuyoshi Nakada 7487371eeb
Make ruby.pc from make
Expand variables undefined in configure.ac, RUBY_RELEASE_DATE and
so on.
2021-08-29 14:08:53 +09:00
Nobuyoshi Nakada 623736ae7f
Move DEFFILE to EXTDLDFLAGS
So that it is no longer needed in ruby.pc.in.
2021-08-29 13:04:42 +09:00
Nobuyoshi Nakada 80c1faf076
Use C99-defined signbit macro 2021-08-27 12:42:23 +09:00
Nobuyoshi Nakada 04be8e84db
Use C99-defined macros to classify a floating-point number 2021-08-27 12:41:30 +09:00
David Carlier 8d2af51a78 netbsd coroutine uses assembly instead and little build fix. 2021-08-24 10:52:04 +09:00
Nobuyoshi Nakada 5087a6a924
Fix COROUTINE_SRC on emscripten
Select the C source if exists, otherwise the assembler source,
instead of selecting by the coroutine type.
2021-08-16 13:45:30 +09:00
DC f8f6d9895d coroutine use asm version for handful of architectures for freebsd. 2021-08-16 12:06:46 +12:00
Nobuyoshi Nakada 372d94b6ba
Shared libruby also needs MAINLIBS for jemalloc 2021-07-07 23:40:04 +09:00
Nobuyoshi Nakada e8d9539373
Refactor --with-jemalloc option
Find jemalloc header first, then using the found header, try [with
mangle, without mangle] x [no more additional libraries, adding
jemalloc] combination.
2021-07-07 23:40:04 +09:00
卜部昌平 82d425515d comment about the situation [ci skip] 2021-07-07 20:31:20 +09:00
卜部昌平 737e4432b9 configure: add -Wl,--no-as-needed
It is reported that combination of `--enable-shared --with-jemalloc`
breaks on Debian bullseye (testig).  Deeper investigation revealed that
this system's `ld(1)` is patched, to turn `ld --as-needed` on by
default.

This linker flag strips "unnecessary" library dependencies from an
executable.  In case of `ruby(1)` (of `--enable-shared`), because
everything is in `libruby.so`, the binary itself doesn't include any
calls to `malloc(3)` at all.  So in spite of our explicit `-ljemalloc`
flag, it is ignored.  Libc's one is chosen instead.

This is not what we want.  Let's force our `ruby(1)` link what we want.

Fixes https://github.com/ruby/ruby/pull/4627

The author would like to acknowledge
Akihiko Odaki <akihiko.odaki@gmail.com> for their contributions.
2021-07-07 20:31:20 +09:00
Nobuyoshi Nakada 91258ed449
Enable libruby-relative on FreeBSD 2021-07-06 21:26:14 +09:00
Nobuyoshi Nakada 166d148355
Fix check for malloc_conf when no library is required 2021-07-06 21:02:41 +09:00
Nobuyoshi Nakada c5e6fa4853
Moved native coroutine type checking message
Not to be interleaved by fallback checking messages
2021-07-06 21:02:40 +09:00
Samuel Williams 42130a64f0
Replace copy coroutine with pthread implementation. 2021-07-01 11:23:03 +12:00
Nobuyoshi Nakada 627aafac86
Remove also debug symbol directory at clean on macOS 2021-06-24 17:04:42 +09:00
Nobuyoshi Nakada 4b28fea6ee
Run ifchange with shell explicitly, workaround of noexec mount 2021-06-22 09:46:40 +09:00
Nobuyoshi Nakada c2d9967f78 Configure ioctl request argument type [Bug #17759] 2021-06-16 13:17:19 +09:00
卜部昌平 90cad6e147 prefer cc/gcc over clang on solaris
requested by tankf33der at https://bugs.ruby-lang.org/issues/17949#change-92430
2021-06-14 22:37:17 +09:00
Nobuyoshi Nakada 7cf90f99f5
Refix PAGE_SIZE
* honor actually used headers
* include sys/user.h only when `PAGE_SIZE` is not defined
2021-05-14 09:33:20 +09:00
John Hawthorn 0aa4ca1477 Fix compilation with jemalloc on macos
On darwin we avoid including sys/user.h to avoid a conflict. Previously
we still ended up with PAGE_SIZE being defined because the headers for
system malloc define it. However, when compiling with jemalloc nothing
would define PAGE_SIZE.

This commit changes configure.ac so that we never use the PAGE_SIZE
constant on darwin and to always use the sysconf fallback.
2021-05-13 11:14:30 -04:00
Nobuyoshi Nakada 2d67027448 Removed missing/dup2.c
This function should be always available, as POSIX-compliant or
Windows platform are required since 1.9.  Also the code in this
file is MT-unsafe.
2021-05-10 15:59:23 +09:00
Nobuyoshi Nakada a1fdc5f71c
Check only whether PAGE_SIZE is compile-time const 2021-05-06 11:30:37 +09:00
Nobuyoshi Nakada 921d8ac99d
Get rid of including sys/user.h on macOS
LIST_HEAD in ccan/list conflicts with sys/queue.h.

```
./ccan/list/list.h:75:9: warning: 'LIST_HEAD' macro redefined [-Wmacro-redefined]
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/queue.h:465:9: note: previous definition is here
        ^
```
2021-05-06 09:39:47 +09:00
Peter Zhu 23a98237df Fix PAGE_SIZE macro detection in autoconf
The current fix for PAGE_SIZE macro detection in autoconf does not work
correctly. I see the following output with running configure on Linux:

```
checking PAGE_SIZE is defined... no
```

Linux has PAGE_SIZE macro. This is happening because the macro exists in
sys/user.h and not in the malloc headers.
2021-05-05 15:31:30 -04:00
Nobuyoshi Nakada 3d5b6ddff8
Fix compilation on M1 Mac
As PAGE_SIZE may not be a preprocessor constant, dispatch at
runtime in that case.
2021-05-05 23:54:36 +09:00