From 5931e48282914758fd7c4eeaf9ca05a16521692b Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 9 Dec 2025 22:34:36 +0800 Subject: fix compile error --- xmake/modules/utils/binary/bin2obj.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xmake/modules/utils/binary/bin2obj.lua') 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) -- cgit v1.3.1