diff --git a/meson.build b/meson.build index d52bb68..e9cf2a8 100644 --- a/meson.build +++ b/meson.build @@ -35,6 +35,9 @@ conf = configuration_data() if os == 'gnu' and arch == 'amd64' ptr_size = 8 func_ptr_size = 8 +elif os == 'gnu' and arch == 'aarch64' + ptr_size = 8 + func_ptr_size = 8 endif conf.set('POINTER_SIZE', ptr_size) diff --git a/src/dynafunc_aarch64_gnu.S b/src/dynafunc_aarch64_gnu.S new file mode 100644 index 0000000..1b7d56a --- /dev/null +++ b/src/dynafunc_aarch64_gnu.S @@ -0,0 +1,31 @@ +/* Copyright 2022, Michele Santullo + * This file is part of wrenpp. + * + * Wrenpp is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Wrenpp is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with wrenpp. If not, see . + */ + +#as --march=generic64 -o dynafunc.o ~/dev/code/cpp/wrentest/src/dynafunc.asm +#objcopy -j .text -O binary dynafunc.o dynafunc.bin +#xxd -i dynafunc.bin + +.global g_dynafunc +.global g_dynafunc_end + +g_dynafunc: + ldr x0, .+12 + ldr x9, .+16 + br x9 + .dword 0xdeadbeefdeadbeef //function parameter + .dword 0xbadc0ffee0ddf00d //function pointer +g_dynafunc_end: