Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions vlib/builtin/builtin_d_gcboehm.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ $if dynamic_boehm ? {
#flag @VEXEROOT/thirdparty/tcc/lib/libgc.a
}
} $else {
#flag -L@VEXEROOT/thirdparty/tcc/lib
#flag -lgc
#flag -Xlinker -rpath -Xlinker "@VEXEROOT/thirdparty/tcc/lib"
#flag @VEXEROOT/thirdparty/tcc/lib/libgc.a
}
} $else {
$if musl ? {
Expand Down
31 changes: 31 additions & 0 deletions vlib/v/builder/gc_flags_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,37 @@ fn test_macos_amd64_tcc_boehm_uses_bundled_libgc_dylib() {
assert run_res.exit_code == 0, run_res.output
}

fn test_macos_system_cc_boehm_uses_bundled_static_libgc() {
$if !macos {
return
}
test_root := os.join_path(os.vtmp_dir(), 'builder_gc_flags_system_cc_${os.getpid()}')
os.mkdir_all(test_root) or { panic(err) }
exe_path := os.join_path(test_root, 'hello_world')
source_path := os.join_path(@VEXEROOT, 'examples', 'hello_world.v')
archive_path := os.join_path(@VEXEROOT, 'thirdparty', 'tcc', 'lib', 'libgc.a')
defer {
os.rmdir_all(test_root) or {}
}
cmd := '${os.quoted_path(@VEXE)} -cc cc -gc boehm -showcc -no-retry-compilation -no-rsp -nocache -o ${os.quoted_path(exe_path)} ${os.quoted_path(source_path)}'
res := execute_without_vflags(cmd)
assert res.exit_code == 0, res.output
lines := res.output.split_into_lines().filter(it.starts_with(showcc_prefix))
assert lines.len == 1, res.output
tokens := tokenize_showcc_command(lines[0][showcc_prefix.len..]) or {
assert false, '${err.msg()}\n${res.output}'
return
}
assert count_showcc_token(tokens, archive_path) == 1, res.output
for token in tokens {
assert !token.contains('libgc.dylib'), res.output
assert !token.contains('rpath'), res.output
assert token != '-lgc', res.output
}
run_res := os.execute(os.quoted_path(exe_path))
assert run_res.exit_code == 0, run_res.output
}

fn test_linux_musl_tcc_boehm_uses_system_libgc() {
$if !linux {
return
Expand Down