Project

General

Profile

Bug #15548

Fix MJIT on OpenBSD when GCC is used to compile

Added by jeremyevans0 (Jeremy Evans) about 1 month ago. Updated 25 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-01-19 trunk 66868) [x86_64-openbsd]
[ruby-core:91172]

Description

OpenBSD's GCC compiler has local extensions that break when -nostartfiles -nodefaultlibs -nostdlib is used. If you leave those flags in, MJIT doesn't work. --jit-verbose=2 output on OpenBSD/amd64 with gcc forced as the compiler shows:

/usr/bin/ld: error: can't create dynamic relocation R_X86_64_PC32 against symbol: __guard_local in readonly segment; recompile object files with -fPIC
>>> defined in /tmp/_ruby_mjit_p43488u28.o
>>> referenced by _ruby_mjit_p43488u28.c
>>>               /tmp/_ruby_mjit_p43488u28.o:(_mjit28)
collect2: ld returned 1 exit status
link_o_to_so: link error: 1

or on OpenBSD/powerpc (where GCC is the default system compiler):

Starting process: cc cc -shared -Wfatal-errors -fPIC -shared -w -pipe -O3 -o /tmp/_ruby_mjit_p40346u0.so /tmp/_ruby_mjit_p40346u0.o -L/usr/local/lib -nostartfiles -nodefaultlibs -nostdlib                                                                                                                                                                                                           
ruby26:/tmp/_ruby_mjit_p40346u0.so: undefined symbol '__guard_local'                                                                                                                                                
MJIT warning: failure in loading code from '/tmp/_ruby_mjit_p40346u0.so': Cannot load specified object

The attached patch fixes the issue.


Files

mjit_worker.diff (1.21 KB) mjit_worker.diff jeremyevans0 (Jeremy Evans), 01/19/2019 07:07 AM

Associated revisions

Revision a5de8d1c
Added by k0kubun (Takashi Kokubun) about 1 month ago

mjit_worker.c: do not use GCC_NOSTDLIB_FLAGS for OpenBSD

OpenBSD's GCC compiler has local extensions that break when
-nostartfiles -nodefaultlibs -nostdlib is used.

From: Jeremy Evans merch-redmine@jeremyevans.net

[Bug #15548]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 66869
Added by k0kubun (Takashi Kokubun) about 1 month ago

mjit_worker.c: do not use GCC_NOSTDLIB_FLAGS for OpenBSD

OpenBSD's GCC compiler has local extensions that break when
-nostartfiles -nodefaultlibs -nostdlib is used.

From: Jeremy Evans merch-redmine@jeremyevans.net

[Bug #15548]

Revision 66be165f
Added by naruse (Yui NARUSE) 25 days ago

merge revision(s) 66823,66869: [Backport #15548]

    Revert "mjit_worker.c: try passing -nostdlib to AIX"

    This reverts commit b32fb23083912c37a2601c66531ed786a7c9f3e5.

    This didn't work on AIX.

    mjit_worker.c: do not use GCC_NOSTDLIB_FLAGS for OpenBSD

    OpenBSD's GCC compiler has local extensions that break when
    `-nostartfiles -nodefaultlibs -nostdlib` is used.

    From: Jeremy Evans <merch-redmine@jeremyevans.net>

    [Bug #15548]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 66924
Added by naruse (Yui NARUSE) 25 days ago

merge revision(s) 66823,66869: [Backport #15548]

Revert "mjit_worker.c: try passing -nostdlib to AIX"

This reverts commit b32fb23083912c37a2601c66531ed786a7c9f3e5.

This didn't work on AIX.

mjit_worker.c: do not use GCC_NOSTDLIB_FLAGS for OpenBSD

OpenBSD's GCC compiler has local extensions that break when
`-nostartfiles -nodefaultlibs -nostdlib` is used.

From: Jeremy Evans <merch-redmine@jeremyevans.net>

[Bug #15548]

History

#1

Updated by k0kubun (Takashi Kokubun) about 1 month ago

  • Status changed from Open to Closed

Applied in changeset trunk|r66869.


mjit_worker.c: do not use GCC_NOSTDLIB_FLAGS for OpenBSD

OpenBSD's GCC compiler has local extensions that break when
-nostartfiles -nodefaultlibs -nostdlib is used.

From: Jeremy Evans merch-redmine@jeremyevans.net

[Bug #15548]

Updated by k0kubun (Takashi Kokubun) about 1 month ago

Applied your patch. Thanks for your help!

Updated by naruse (Yui NARUSE) 25 days ago

  • Backport changed from 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE

ruby_2_6 r66924 merged revision(s) 66823,66869.

Also available in: Atom PDF