summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-07 11:17:46 +0800
committerruki <[email protected]>2025-12-07 17:15:59 +0800
commitcae5b0a17dc7d0eb5599c0d5a92fab69d39983d5 (patch)
treed459ac9eeb285bb4ba48d7ef5a5f9da375b53434 /xmake/modules/private/utils
parent00f6b0ba403a86ad542a1fbecc142064aa641f0d (diff)
support for iphoneos in bin2macho
Diffstat (limited to 'xmake/modules/private/utils')
-rw-r--r--xmake/modules/private/utils/bin2obj.lua19
1 files changed, 13 insertions, 6 deletions
diff --git a/xmake/modules/private/utils/bin2obj.lua b/xmake/modules/private/utils/bin2obj.lua
index 2221adf3c..a27f5c5dc 100644
--- a/xmake/modules/private/utils/bin2obj.lua
+++ b/xmake/modules/private/utils/bin2obj.lua
@@ -26,15 +26,19 @@ local options = {
{'o', "outputpath", "kv", nil, "Set the output object file path."},
{'f', "format", "kv", nil, "Set the object file format (coff, elf, macho)."},
{nil, "symbol-prefix", "kv", nil, "Set the symbol prefix (default: _binary_)."},
- {'a', "arch", "kv", nil, "Set the target architecture."}
+ {'a', "arch", "kv", nil, "Set the target architecture."},
+ {'p', "plat", "kv", nil, "Set the target platform (macosx, iphoneos, etc.)."}
}
function _do_bin2obj_coff(binarypath, outputpath, opt)
-- get symbol prefix
local symbol_prefix = opt["symbol-prefix"] or "_binary_"
- -- get architecture
- local arch = opt.arch
+ -- get architecture (default: x86_64)
+ local arch = opt.arch or "x86_64"
+
+ -- get platform (not used for COFF, but passed for consistency)
+ local platform = opt.plat
-- get filename from binary path (with extension, dots replaced with underscores)
local filename = path.filename(binarypath)
@@ -63,8 +67,11 @@ function _do_bin2obj_macho(binarypath, outputpath, opt)
-- get symbol prefix
local symbol_prefix = opt["symbol-prefix"] or "_binary_"
- -- get architecture
- local arch = opt.arch
+ -- get platform (default: macosx)
+ local plat = opt.plat or "macosx"
+
+ -- get architecture (default: x86_64)
+ local arch = opt.arch or "x86_64"
-- get filename from binary path (with extension, dots replaced with underscores)
local filename = path.filename(binarypath)
@@ -76,7 +83,7 @@ function _do_bin2obj_macho(binarypath, outputpath, opt)
-- do dump
if utils.bin2macho then
- utils.bin2macho(binarypath, outputpath, symbol_prefix, arch, basename)
+ utils.bin2macho(binarypath, outputpath, symbol_prefix, plat, arch, basename)
else
raise("bin2obj: utils.bin2macho not available (C implementation not compiled)")
end