[arm] Fix branch island disassembly for arm64 and thumb. (#19189)
commit338349925cd380cad2d19c6c15184cf22cf14800
authormonojenkins <jo.shields+jenkins@xamarin.com>
Wed, 11 Mar 2020 17:37:50 +0000 (11 13:37 -0400)
committerGitHub <noreply@github.com>
Wed, 11 Mar 2020 17:37:50 +0000 (11 10:37 -0700)
tree41b25632bf0600b2924a91e63ea9685a4bb6d97a
parent3a4122f14fb70fe1c73fb6a9a0e8f8ad09874b79
[arm] Fix branch island disassembly for arm64 and thumb. (#19189)

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: Imran Hameed <imhameed@microsoft.com>
mono/mini/aot-runtime.c
mono/mini/tramp-arm64.c