canonical paths

This commit is contained in:
2026-02-23 11:18:08 -06:00
parent f26b6e853d
commit 193991c532
3 changed files with 34 additions and 32 deletions

View File

@@ -920,17 +920,17 @@ Build.compile_native = function(src_path, target, buildtype, pkg) {
var qbe_emit = use('qbe_emit')
// Step 2: Generate QBE IL
// Use relative path from package dir for symbol name (must match loader in try_native_mod_dylib)
// Derive package from the file itself (not the caller's context) to ensure correct symbol names
var sym_name = null
var _pkg_dir = null
var _file_info = shop.file_info(src_path)
var _actual_pkg = _file_info.package || pkg
var _sym_stem = null
if (pkg) {
_pkg_dir = shop.get_package_dir(pkg)
if (starts_with(src_path, _pkg_dir + '/'))
_sym_stem = text(src_path, length(_pkg_dir) + 1)
if (_actual_pkg) {
if (_file_info.name)
_sym_stem = _file_info.name + (_file_info.is_actor ? '.ce' : '.cm')
else
_sym_stem = fd.basename(src_path)
sym_name = shop.c_symbol_for_file(pkg, _sym_stem)
sym_name = shop.c_symbol_for_file(_actual_pkg, _sym_stem)
}
var il_parts = qbe_emit(optimized, qbe_macros, sym_name)
@@ -1001,16 +1001,17 @@ Build.compile_native_ir = function(optimized, src_path, opts) {
var qbe_macros = use('qbe')
var qbe_emit = use('qbe_emit')
// Derive package from the file itself (not the caller's context)
var sym_name = null
var _pkg_dir2 = null
var _file_info2 = shop.file_info(src_path)
var _actual_pkg2 = _file_info2.package || pkg
var _sym_stem2 = null
if (pkg) {
_pkg_dir2 = shop.get_package_dir(pkg)
if (starts_with(src_path, _pkg_dir2 + '/'))
_sym_stem2 = text(src_path, length(_pkg_dir2) + 1)
if (_actual_pkg2) {
if (_file_info2.name)
_sym_stem2 = _file_info2.name + (_file_info2.is_actor ? '.ce' : '.cm')
else
_sym_stem2 = fd.basename(src_path)
sym_name = shop.c_symbol_for_file(pkg, _sym_stem2)
sym_name = shop.c_symbol_for_file(_actual_pkg2, _sym_stem2)
}
var il_parts = qbe_emit(optimized, qbe_macros, sym_name)