find_symbol fails on Mach-O
See original GitHub issueAttempting to run find_symbol(string)
on a Mach-O binary results in the error:
File "cle/loader.py", line 473, in find_symbol
if sym.is_import:
AttributeError: 'list' object has no attribute 'is_import'
This is because the Mach-O implementation of get_symbol
always returns a list rather than a single symbol as expected by load_symbol
.
Pip version cle 8.19.4.5
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Find symbol address of Mach-o from mach_header in ...
I have a mach-o file loaded in memory (via mmap ) and need to get the address in the binary corresponding to a...
Read more >[llvm-dev] Kaleidoscope on Windows - bug maybe found?
The root cause of this problem is in libObject - ELF and MachO objects ... this still fails: > > auto ExprSymbol =...
Read more >lld/MachONormalizedFileFromAtoms.cpp at master · llvm- ...
lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp ... llvm::Error getSymbolTableRegion(const DefinedAtom* atom,. bool &inGlobalsRegion,.
Read more >MachO — LIEF Documentation
MachO.ParserConfig object at 0x7fdde5b460b0>) -> object. Parse the given binary from a Python IO interface and return a FatBinary object.
Read more >https://opensource.apple.com/source/libffi/libffi-...
SymbolTable import SymbolTable from macholib.ptypes import * from macholib import mach_o ... 0: raise Exception("nm failed") syms = list() for line in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Because I am probably the only person around here that feels somewhat responsible for the Mach-O backend, I will be looking into this. The current
get_symbol
implementation obviously violates assumptions made by other parts of CLE(a strong case for type annotations and checking). The question is of the rest of CLE should be changed to handle binaries with duplicate symbol names (which is allowed in Mach-O) or the backend should be changed so it always returns one symbol, however that is chosen. Namespacing would be one option for the latter, but that might require changes to CLE again to support the concept of namespaces instead of just building them as a string. Other option would be that only an index is valid as an argument forget_symbol
and a str requires an additional parameter to specify a namespace or accept a list as a result.This issue has been closed due to inactivity.