diff options
Diffstat (limited to 'xmake/modules/utils/binary/readsyms.lua')
| -rw-r--r-- | xmake/modules/utils/binary/readsyms.lua | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/xmake/modules/utils/binary/readsyms.lua b/xmake/modules/utils/binary/readsyms.lua index 6aaa414d0..e5954e92a 100644 --- a/xmake/modules/utils/binary/readsyms.lua +++ b/xmake/modules/utils/binary/readsyms.lua @@ -81,11 +81,28 @@ function dump(binaryfile) end end --- read symbols from object file (auto-detect format: ELF, COFF, Mach-O) +-- read symbols from object file(s) (auto-detect format: ELF, COFF, Mach-O) -- --- @param binaryfile the object file path (required) --- @return the symbols table +-- @param binaryfile the object file path or table of object files (required) +-- @return the symbols table (all symbols from all files if table is provided) function main(binaryfile) - return _get_symbols(binaryfile) + assert(binaryfile, "usage: xmake l utils.binary.readsyms <binaryfile> or readsyms(binaryfiles)") + + local all_symbols = {} + if type(binaryfile) == "string" then + -- single file + return _get_symbols(binaryfile) + else + -- multiple files + for _, objectfile in ipairs(binaryfile) do + local symbols = _get_symbols(objectfile) + if symbols then + for _, sym in ipairs(symbols) do + table.insert(all_symbols, sym) + end + end + end + return all_symbols + end end |
