fixed function arity

This commit is contained in:
2026-01-25 13:51:34 -06:00
parent 802c94085b
commit 8325253f1a
6 changed files with 223 additions and 116 deletions

View File

@@ -121,11 +121,11 @@ Build.compile_file = function(pkg, file, target, buildtype = 'release') {
// Add buildtype-specific flags
if (buildtype == 'release') {
push(cmd_parts, '-O3', '-DNDEBUG')
cmd_parts = array(cmd_parts, ['-O3', '-DNDEBUG'])
} else if (buildtype == 'debug') {
push(cmd_parts, '-O2', '-g')
cmd_parts = array(cmd_parts, ['-O2', '-g'])
} else if (buildtype == 'minsize') {
push(cmd_parts, '-Os', '-DNDEBUG')
cmd_parts = array(cmd_parts, ['-Os', '-DNDEBUG'])
}
push(cmd_parts, '-DCELL_USE_NAME=' + sym_name)
@@ -278,23 +278,20 @@ Build.build_dynamic = function(pkg, target = Build.detect_host_target(), buildty
// Platform-specific flags for undefined symbols (resolved at dlopen) and size optimization
if (tc.system == 'darwin') {
// Allow undefined symbols - they will be resolved when dlopen'd into the main executable
push(cmd_parts, '-undefined', 'dynamic_lookup')
// Dead-strip unused code
push(cmd_parts, '-Wl,-dead_strip')
// Set install_name to stable path so runtime finds it correctly
push(cmd_parts, '-Wl,-install_name,' + stable_path)
// rpath for .cell/local libraries
push(cmd_parts, '-Wl,-rpath,@loader_path/../local')
push(cmd_parts, '-Wl,-rpath,' + local_dir)
cmd_parts = array(cmd_parts, [
'-undefined', 'dynamic_lookup',
'-Wl,-dead_strip',
'-Wl,-install_name,' + stable_path,
'-Wl,-rpath,@loader_path/../local',
'-Wl,-rpath,' + local_dir
])
} else if (tc.system == 'linux') {
// Allow undefined symbols at link time
push(cmd_parts, '-Wl,--allow-shlib-undefined')
// Garbage collect unused sections
push(cmd_parts, '-Wl,--gc-sections')
// rpath for .cell/local libraries
push(cmd_parts, '-Wl,-rpath,$ORIGIN/../local')
push(cmd_parts, '-Wl,-rpath,' + local_dir)
cmd_parts = array(cmd_parts, [
'-Wl,--allow-shlib-undefined',
'-Wl,--gc-sections',
'-Wl,-rpath,$ORIGIN/../local',
'-Wl,-rpath,' + local_dir
])
} else if (tc.system == 'windows') {
// Windows DLLs: use --allow-shlib-undefined for mingw
push(cmd_parts, '-Wl,--allow-shlib-undefined')
@@ -308,17 +305,11 @@ Build.build_dynamic = function(pkg, target = Build.detect_host_target(), buildty
})
// Do NOT link against core library - symbols resolved at dlopen time
cmd_parts = array(cmd_parts, resolved_ldflags)
cmd_parts = array(cmd_parts, target_ldflags)
// Add LDFLAGS
arrfor(resolved_ldflags, function(flag) {
push(cmd_parts, flag)
})
arrfor(target_ldflags, function(flag) {
push(cmd_parts, flag)
})
push(cmd_parts, '-o', '"' + store_path + '"')
push(cmd_parts, '-o')
push(cmd_parts, '"' + store_path + '"')
var cmd_str = text(cmd_parts, ' ')