Skip to content

ARM64: unable to assemble bl instruction #6042

@1337-42

Description

@1337-42

Version and Platform (required):

  • Binary Ninja Version: 4.2.6298-dev, 3fb67302
  • OS: macos
  • OS Version: 14.7
  • CPU Architecture: arm64

Bug Description:
Binary Ninja is unable to reassemble its assembly output.

Steps To Reproduce:

  • Disassemble an ARM64-mac binary
  • Find a branch instruction
  • Run this Python snippet
>>> bv.get_disassembly(current_address, bv.arch)
'bl      0x1000700a0'
>>> disasm = bv.get_disassembly(current_address, bv.arch)
>>> print(disasm)
bl      0x1000700a0
>>> bv.arch.assemble(disasm, current_address)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/architecture.py", line 2510, in assemble
    raise ValueError(f"Could not assemble: {error_str}")
ValueError: Could not assemble: b'line 37: expected label or encodable integer pc offset\n'

Expected Behavior:
The output should be the assembled bytes.

Screenshots:

image

Additional Information:
Other instructions seem to assemble just fine. It's only when offsets are used in, for example, branch instructions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    State: DuplicateIssue is a duplicate of another issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions