summaryrefslogtreecommitdiff
path: root/xmake/core/base/binutils.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-12-09 00:29:51 +0800
committerruki <[email protected]>2025-12-09 00:29:51 +0800
commitba293bc4b8840da34220e1f54313d531d18dde8e (patch)
treee6b6325ccf446b845b26a3a21f06f0bd84914170 /xmake/core/base/binutils.lua
parentf1726a8f0f63160ae2185f28b38a740caf6d1ab1 (diff)
add binary readsyms
Diffstat (limited to 'xmake/core/base/binutils.lua')
-rw-r--r--xmake/core/base/binutils.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/core/base/binutils.lua b/xmake/core/base/binutils.lua
index b21de2276..8047046b2 100644
--- a/xmake/core/base/binutils.lua
+++ b/xmake/core/base/binutils.lua
@@ -26,6 +26,7 @@ binutils._bin2c = binutils._bin2c or binutils.bin2c
binutils._bin2coff = binutils._bin2coff or binutils.bin2coff
binutils._bin2macho = binutils._bin2macho or binutils.bin2macho
binutils._bin2elf = binutils._bin2elf or binutils.bin2elf
+binutils._readsyms = binutils._readsyms or binutils.readsyms
-- generate c/c++ code from the binary file
function binutils.bin2c(binaryfile, outputfile, opt)
@@ -56,6 +57,15 @@ function binutils.bin2elf(binaryfile, outputfile, opt)
return binutils._bin2elf(binaryfile, outputfile, opt.symbol_prefix or "_binary_", opt.arch or "x86_64", opt.basename, opt.zeroend or false)
end
+-- read symbols from object file (auto-detect format: COFF, ELF, or Mach-O)
+function binutils.readsyms(binaryfile)
+ if binutils._readsyms then
+ return binutils._readsyms(binaryfile)
+ else
+ return nil, "readsyms: C implementation not available"
+ end
+end
+
-- return module
return binutils