ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: naruse@airemix.jp
To: ruby-core@ruby-lang.org
Subject: [ruby-core:91273] [Ruby trunk Bug#15548] Fix MJIT on OpenBSD when GCC is used to compile
Date: Sat, 26 Jan 2019 07:59:16 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-76518.20190126075914.3b7b709307ac7267@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15548.20190119071246@ruby-lang.org

Issue #15548 has been updated by naruse (Yui NARUSE).

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.

----------------------------------------
Bug #15548: Fix MJIT on OpenBSD when GCC is used to compile
https://bugs.ruby-lang.org/issues/15548#change-76518

* Author: jeremyevans0 (Jeremy Evans)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0dev (2019-01-19 trunk 66868) [x86_64-openbsd]
* Backport: 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

      parent reply	other threads:[~2019-01-26  7:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15548.20190119071246@ruby-lang.org>
2019-01-19  7:12 ` [ruby-core:91172] [Ruby trunk Bug#15548] Fix MJIT on OpenBSD when GCC is used to compile merch-redmine
2019-01-19  7:27 ` [ruby-core:91173] " takashikkbn
2019-01-26  7:59 ` naruse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-76518.20190126075914.3b7b709307ac7267@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).