Skip to content

Commit 3252693

Browse files
committed
[GR-18163] Ensure the rb_tr_abi_version symbol is always visible/exported
PullRequest: truffleruby/2749
2 parents 996966b + 843b1c8 commit 3252693

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

lib/cext/ABI_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4
1+
5

lib/cext/include/truffleruby/truffleruby-pre.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
extern "C" {
1919
#endif
2020

21+
RUBY_SYMBOL_EXPORT_BEGIN
22+
2123
#define TRUFFLERUBY
2224

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

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

83+
RUBY_SYMBOL_EXPORT_END
84+
7885
#if defined(__cplusplus)
7986
}
8087
#endif

lib/truffle/rbconfig.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module RbConfig
7373

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

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

113-
relative_debug_paths = "-fdebug-prefix-map=#{ruby_home}=."
113+
relative_debug_paths = " -fdebug-prefix-map=#{ruby_home}=."
114114
cppflags << relative_debug_paths
115115

116116
warnflags << '-Wundef' # Warn for undefined preprocessor macros for core C extensions

tool/jt.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
CACHE_EXTRA_DIR = File.expand_path('~/.mx/cache/truffleruby')
3333
FileUtils.mkdir_p(CACHE_EXTRA_DIR)
3434

35-
TRUFFLERUBY_GEM_TEST_PACK_VERSION = 'a63ccfd1f020f50ddd8d2e6cfd11242fd72edca0'
35+
TRUFFLERUBY_GEM_TEST_PACK_VERSION = '58d3048b49629102945a60918f31bf74547f51f9'
3636

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

0 commit comments

Comments
 (0)