Код: Выделить всё
#include
#include "asmjit.h"
#include "a64.h"
using namespace asmjit;
typedef int (*SumFunc)(int, int);
int main() {
// Signature of the generated function.
for (int nop_num = 0; nop_num < 10; nop_num += 1) {
JitRuntime rt; // Create a runtime specialized for JIT.
CodeHolder code; // Create a CodeHolder.
code.init(
rt.environment()); // Initialize code to match the JIT environment.
a64::Assembler a(&code); // Create and attach a64::Assembler to code.
// a64::Gp s1 = a64::w0;
// a64::Gp s2 = a64::w1;
// a64::Gp result = a64::w11;
a.add(a64::w0, a64::w0, a64::w1);
a.ret(a64::w0);
SumFunc fn;
Error err = rt.add(&fn, &code); // Add the generated code to the runtime.
if (err) return 1; // Handle a possible error returned by AsmJit.
int final_result = fn(10, 20); // Execute our constructed function fn
printf("%d", final_result);
rt.release(fn); // Explicitly remove the function from the runtime
code.reset();
}
return 0;
}
Действия, которые я пробовал
Я подтвердил, что моя система имеет архитектуру aarch64 и что настройки компилятора GCC верны.
Я попробовал другие фрагменты кода из примеров AsmJit и столкнулся с той же проблемой.
Я сверился с документацией AsmJit на предмет соответствующих параметров конфигурации или известных проблем совместимости, но не нашел нашел какие-либо явные зацепки.
Я надеюсь найти способ правильно использовать AsmJit в aarch64 Linux или понять потенциальные причины этой проблемы. Спасибо за любую помощь, которую вы можете оказать!
Подробнее здесь: https://stackoverflow.com/questions/784 ... simple-c-c