[arm] Fix branch island disassembly for arm64 and thumb. (#33469)
authormonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 11 Mar 2020 12:43:53 +0000 (08:43 -0400)
committerGitHub <noreply@github.com>
Wed, 11 Mar 2020 12:43:53 +0000 (13:43 +0100)
commit74370b6e8029a68df01a7ca40a78da1e6a26337e
treed86f69f28d8bf8e0d029ed4d8f0dc6089af77bef
parent8daa72836f1c827863e6a56043e33b11c6bc1baa
[arm] Fix branch island disassembly for arm64 and thumb. (#33469)

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.

Co-authored-by: imhameed <imhameed@users.noreply.github.com>
src/mono/mono/mini/aot-runtime.c
src/mono/mono/mini/tramp-arm64.c