AArch64 opnd_create_abs_addr() succeeds but opnd_is_memory_reference() returns false
For #4134 (closed) and #3995 I'm porting drbbdup to arm and its tests call opnd_create_abs_addr()
to create the runtime_case_opnd
. DR lets it create an absolute addr opnd of type ABS_ADDR_kind
on AArch64; but then opnd_is_memory_reference
returns false on AArch64 because the check for opnd_is_abs_addr()
is limited to IF_X86_64
. Basically, DR isn't sure it wants to support absolute address operands for AArch64, since the addressing modes there do not have that sort of thing. Maybe users are expected to use opnd_create_rel_addr()
instead (AArch64 does have #define OPND_CREATE_ABSMEM(addr, size) opnd_create_rel_addr(addr, size)
): but the docs for opnd_create_abs_addr()
say it will auto-convert into a rel addr.
The rest of the code for abs addr handling in opnd_shared.c is just gated by X64
, so opnd_is_memory_reference
looks like an anomaly. So maybe the solution is to fix opnd_is_memory_reference
to return true, and ensure the AArch64 and ARM encoders handle ABS_ADDR_kind
and treat it just like rel-addr (the alternative of converting to rel-addr at creation time might confuse users who would query their own just-created abs-addr opnd and it would return false for opnd_is_abs_addr()
).
I went to check whether the AArch64 encoder might already handle abs-addr: but it looks like it doesn't even handle rel-addr! See https://github.com/DynamoRIO/dynamorio/issues/4847#issuecomment-1023433975