summaryrefslogtreecommitdiff
path: root/xmake/modules/utils/binary/bin2obj.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules/utils/binary/bin2obj.lua')
-rw-r--r--xmake/modules/utils/binary/bin2obj.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/xmake/modules/utils/binary/bin2obj.lua b/xmake/modules/utils/binary/bin2obj.lua
index 7870e2544..95e705ca6 100644
--- a/xmake/modules/utils/binary/bin2obj.lua
+++ b/xmake/modules/utils/binary/bin2obj.lua
@@ -47,17 +47,17 @@ function _do_bin2obj(binarypath, outputpath, opt)
local basename = filename:gsub("%.", "_")
opt.basename = basename
- -- get format (default: coff)
- local format = opt.format or "coff"
- format = format:lower()
-
-- validate format
- if format ~= "coff" and format ~= "elf" and format ~= "macho" then
- raise("bin2obj: unsupported format '%s' (supported: coff, elf, macho)", format)
+ local format = opt.format
+ if format then
+ format = format:lower()
+ if format ~= "coff" and format ~= "elf" and format ~= "macho" then
+ raise("bin2obj: unsupported format '%s' (supported: coff, elf, macho)", format)
+ end
end
-- trace
- print("converting binary file %s to %s object file %s ..", binarypath, format, outputpath)
+ print("converting binary file %s to %s object file %s ..", binarypath, format or "coff", outputpath)
-- do conversion
binutils.bin2obj(binarypath, outputpath, opt)