Skip to content

Instantly share code, notes, and snippets.

@pgoodman
Created November 5, 2019 18:16
Show Gist options
  • Save pgoodman/fe1d17615c45b183eccd9821109cbc70 to your computer and use it in GitHub Desktop.
Save pgoodman/fe1d17615c45b183eccd9821109cbc70 to your computer and use it in GitHub Desktop.
Using ANVILL with AArch64
clang --target=armv8-pc-linux-gnu -m64 -c /tmp/test.c -o /tmp/test.o
; Function Attrs: noinline nounwind ssp
define i64 @test(i64, i8) local_unnamed_addr #0 {
%3 = zext i8 %1 to i64
%4 = add i64 %3, %0
%5 = and i64 %3, 63
%6 = shl i64 %4, %5
%7 = tail call %struct.Memory* @__remill_function_return(%struct.State* nonnull undef, i64 0, %struct.Memory* null) #2
ret i64 %6
}
{
"os": "linux",
"functions": [
{
"return_stack_pointer": {"register": "SP", "type": "L", "offset": 0},
"name": "test",
"parameters": [
{"register": "X0", "type": "l"},
{"register": "W1", "type": "b"}
],
"return_address": {"register": "X0", "type": "L"},
"return_values": [
{"register": "X0", "type": "l"}
],
"address": 0
}
],
"arch": "aarch64",
"stack": {"size": 24576, "start_offset": 4096, "address": 87960930222080},
"memory": [
{
"is_writeable": false,
"data": "ff4300d1e00700f9e1130039e00740f9e1134039e803012a0800088be1134039e003012a007c40d30021c09aff430091c0035fd6",
"is_executable": true,
"is_readable": true,
"address": 0
}
]
}
long long test(long long x, char y) {
return (x + y) << y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment