Skip to content

Commit

Permalink
[GR-18163] Ensure the rb_tr_abi_version symbol is always visible/expo…
Browse files Browse the repository at this point in the history
…rted

PullRequest: truffleruby/2749
  • Loading branch information
eregon committed Jun 22, 2021
2 parents 996966b + 843b1c8 commit 3252693
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cext/ABI_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4
5
7 changes: 7 additions & 0 deletions lib/cext/include/truffleruby/truffleruby-pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
extern "C" {
#endif

RUBY_SYMBOL_EXPORT_BEGIN

#define TRUFFLERUBY

#include <graalvm/llvm/polyglot.h>
Expand Down Expand Up @@ -53,6 +55,9 @@ POLYGLOT_DECLARE_TYPE(VALUE)
extern void* rb_tr_cext;
#define RUBY_CEXT rb_tr_cext

#ifndef TRUFFLERUBY_ABI_VERSION
#error "TRUFFLERUBY_ABI_VERSION must be defined when compiling native extensions. Does the extension override CPPFLAGS or DEFS?"
#endif
void* rb_tr_abi_version(void) __attribute__((weak));
void* rb_tr_abi_version(void) {
char* abi_version = STRINGIZE(TRUFFLERUBY_ABI_VERSION);
Expand All @@ -75,6 +80,8 @@ extern ID (*rb_tr_sym2id)(VALUE sym);
#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
#endif

RUBY_SYMBOL_EXPORT_END

#if defined(__cplusplus)
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions lib/truffle/rbconfig.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module RbConfig

# Determine the various flags for native compilation
optflags = ''
debugflags = "-DTRUFFLERUBY_ABI_VERSION=#{ruby_abi_version}"
debugflags = ''
warnflags = [
'-Wimplicit-function-declaration', # To make missing C ext functions clear
'-Wno-int-conversion', # MRI has VALUE defined as long while we have it as void*
Expand All @@ -84,7 +84,7 @@ module RbConfig
'-ferror-limit=500'
]

defs = ''
defs = "-DTRUFFLERUBY_ABI_VERSION=#{ruby_abi_version}"
cppflags = ''
ldflags = ''
dldflags = Truffle::Platform.darwin? ? '-Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress' : ''
Expand All @@ -110,7 +110,7 @@ module RbConfig
if Truffle::Boot.get_option 'building-core-cexts'
libtruffleruby = "#{ruby_home}/src/main/c/cext/libtruffleruby.#{dlext}"

relative_debug_paths = "-fdebug-prefix-map=#{ruby_home}=."
relative_debug_paths = " -fdebug-prefix-map=#{ruby_home}=."
cppflags << relative_debug_paths

warnflags << '-Wundef' # Warn for undefined preprocessor macros for core C extensions
Expand Down
2 changes: 1 addition & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
CACHE_EXTRA_DIR = File.expand_path('~/.mx/cache/truffleruby')
FileUtils.mkdir_p(CACHE_EXTRA_DIR)

TRUFFLERUBY_GEM_TEST_PACK_VERSION = 'a63ccfd1f020f50ddd8d2e6cfd11242fd72edca0'
TRUFFLERUBY_GEM_TEST_PACK_VERSION = '58d3048b49629102945a60918f31bf74547f51f9'

JDEBUG = '--vm.agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y'
METRICS_REPS = Integer(ENV['TRUFFLERUBY_METRICS_REPS'] || 10)
Expand Down

0 comments on commit 3252693

Please sign in to comment.