Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix RB_GC_GUARD_PTR on non-GCC/non-MSC builds #1293

Closed
wants to merge 1 commit into from
Closed

fix RB_GC_GUARD_PTR on non-GCC/non-MSC builds #1293

wants to merge 1 commit into from

Conversation

lamont-granquist
Copy link

  • the definition of RB_GC_GUARD_PTR needs to be moved into the block
    which is MSC-specific since in the non-MSC/non-GCC codepath here we
    do not have any rb_gc_guarded_ptr defined.
  • i alised RB_GC_GUARD_PTR to RB_GC_GUARD which i think is how people
    are intending to use this macro?
  • people are in fact using this macro as a public API even though
    there is the comment in the code not to.

- the definition of RB_GC_GUARD_PTR needs to be moved into the block
which is MSC-specific since in the non-MSC/non-GCC codepath here we
do not have any rb_gc_guarded_ptr defined.

- i alised RB_GC_GUARD_PTR to RB_GC_GUARD which i think is how people
are intending to use this macro?

- people are in fact using this macro as a public API even though
there is the comment in the code not to.
@lamont-granquist
Copy link
Author

See ffi/ffi#489

On AIX using ruby compiled with xlc and trying to use the ffi gem (which uses RB_GUARD_PTR) i get:

exec(): 0509-036 Cannot load program ruby because of the following errors:
rtld: 0712-001 Symbol rb_gc_guarded_ptr was referenced
      from module /opt/chef/embedded/lib/ruby/gems/2.2.0/gems/ffi-1.9.10/lib/ffi_c.so(), but a runtime definition
      of the symbol was not found.
rtld: 0712-002 fatal error: exiting.

The error is accurate because in non-GGC/non-Windows codepaths rb_gc_guarded_ptr is referenced from the RB_GC_GUARD_PTR macro but never defined.

At least the RB_GC_GUARD_PTR macro should be itself undefined to move this error to compile time rather than link type and make it a bit more obvious.

@nobu
Copy link
Member

nobu commented Mar 17, 2016

ffi/ffi#490 is correct.

@nobu nobu closed this Mar 17, 2016
hsbt pushed a commit that referenced this pull request Mar 17, 2016
* include/ruby/ruby.h (RB_GC_GUARD_PTR): remove intermediate
  macro, and expand for each RB_GC_GUARD.  [Fix GH-1293]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mrkn pushed a commit to mrkn/ruby that referenced this pull request Apr 17, 2016
* include/ruby/ruby.h (RB_GC_GUARD_PTR): remove intermediate
  macro, and expand for each RB_GC_GUARD.  [Fix rubyGH-1293]

git-svn-id: svn+ssh://svn.ruby-lang.org/ruby/trunk@54158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
tenderlove pushed a commit to tenderlove/ruby that referenced this pull request May 1, 2016
* include/ruby/ruby.h (RB_GC_GUARD_PTR): remove intermediate
  macro, and expand for each RB_GC_GUARD.  [Fix rubyGH-1293]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants