diff --git a/baremetal/lib/aarch64.S b/baremetal/lib/aarch64.S index 79203fd..3c887ca 100644 --- a/baremetal/lib/aarch64.S +++ b/baremetal/lib/aarch64.S @@ -21,12 +21,10 @@ mystart: LKMC_VECTOR_TABLE -/* Default trap handler that does nothing. - * - * Weak means that if any other file defines it as a non-weak global, - * that one will take precedence. - * - * We need this one to not get undefined references. - */ +/* Default trap handler. */ LKMC_WEAK(lkmc_vector_trap_handler) - ret + ldr x0, =lkmc_vector_trap_handler_error + bl puts + bl lkmc_assert_fail +lkmc_vector_trap_handler_error: + .asciz "error: unexpected interrupt" diff --git a/lkmc.h b/lkmc.h index a6f46a6..315f2ea 100644 --- a/lkmc.h +++ b/lkmc.h @@ -22,6 +22,10 @@ bool lkmc_vector_equal(size_t n, double *v1, double *v2, double max_err); .global name; \ name: +/* Weak means that if any other file defines it as a non-weak global, + * that one will take precedence: + * https://stackoverflow.com/questions/274753/how-to-make-weak-linking-work-with-gcc/54601464#54601464 + */ #define LKMC_WEAK(name) \ .weak name; \ name: