[arm] Fix branch island disassembly for arm64 and thumb. (#19188)
commitb74bbe92693430b41ddc4cdb6c5d94c27c650aea
authorimhameed <imhameed@microsoft.com>
Wed, 11 Mar 2020 12:43:08 +0000 (11 05:43 -0700)
committerGitHub <noreply@github.com>
Wed, 11 Mar 2020 12:43:08 +0000 (11 13:43 +0100)
treecf38c4d575ba58572719385784c64a9fc8f57316
parent30f5d3440090f3c7ad61ebbcba3e9b6b2507f6af
[arm] Fix branch island disassembly for arm64 and thumb. (#19188)

Followup to https://github.com/mono/mono/pull/19126 and
https://github.com/mono/mono/pull/19169.

Bring arm64 `mono_arch_get_call_target` in line with other platforms by
returning NULL on failure instead of asserting. Bits 30-26 in an arm64
unconditional branch are exactly 0b00101, so 0x1f (0b11111) is used as a
mask to determine if the branch uses an immediate target--0x7 (0b111)
would incorrectly match against branches using register targets. The
extracted immediate is now sign extended in a branch-free way.

Avoid following blx entries in the method address table; ld64 can emit 4
different instruction sequences for islands involving thumb, and I'd
rather not implement support for them all now because 32-bit iOS is old
and large unlinked assemblies seem rare.
mono/mini/aot-runtime.c
mono/mini/tramp-arm64.c