Skip to content

Commit

Permalink
Define TRUFFLERUBY_ABI_VERSION in DEFS, part of CPPFLAGS
Browse files Browse the repository at this point in the history
* Error when TRUFFLERUBY_ABI_VERSION isn't defined to fail early and more clearly.
* Fix missing space before relative_debug_paths.
  • Loading branch information
eregon committed Jun 22, 2021
1 parent d4a0721 commit 843b1c8
Show file tree
Hide file tree
Showing 4 changed files with 8 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
3 changes: 3 additions & 0 deletions lib/cext/include/truffleruby/truffleruby-pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,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 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 843b1c8

Please sign in to comment.