Skip to content

Commit 95af77e

Browse files
committed
Place MODULAR_GC_DIR under exec_prefix unless starting with a slash
1 parent 6ed9342 commit 95af77e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,10 @@ typedef struct gc_function_map {
706706

707707
static rb_gc_function_map_t rb_gc_functions;
708708

709+
#if !defined(LOAD_RELATIVE)
710+
#include "verconf.h"
711+
#endif
712+
709713
# define RUBY_GC_LIBRARY "RUBY_GC_LIBRARY"
710714
# define MODULAR_GC_DIR STRINGIZE(modular_gc_dir)
711715

@@ -737,7 +741,7 @@ ruby_modular_gc_init(void)
737741
}
738742
}
739743

740-
size_t gc_so_path_size = strlen(MODULAR_GC_DIR "librubygc." DLEXT) + strlen(gc_so_file) + 1;
744+
size_t gc_so_path_size = rb_strlen_lit(MODULAR_GC_DIR "librubygc." DLEXT) + strlen(gc_so_file) + 1;
741745
#ifdef LOAD_RELATIVE
742746
Dl_info dli;
743747
size_t prefix_len = 0;
@@ -757,6 +761,8 @@ ruby_modular_gc_init(void)
757761
gc_so_path_size += prefix_len;
758762
}
759763
}
764+
#else
765+
if (MODULAR_GC_DIR[0] != '/') gc_so_path_size += rb_strlen_lit(RUBY_EXEC_PREFIX);
760766
#endif
761767
gc_so_path = alloca(gc_so_path_size);
762768
{
@@ -769,6 +775,8 @@ ruby_modular_gc_init(void)
769775
memcpy(gc_so_path, dli.dli_fname, prefix_len);
770776
gc_so_path_idx = prefix_len;
771777
}
778+
#else
779+
if (MODULAR_GC_DIR[0] != '/') GC_SO_PATH_APPEND(RUBY_EXEC_PREFIX);
772780
#endif
773781
GC_SO_PATH_APPEND(MODULAR_GC_DIR "librubygc.");
774782
GC_SO_PATH_APPEND(gc_so_file);

0 commit comments

Comments
 (0)