diff --git a/include/ktls.h b/include/ktls.h index 7637268b5..942b1118b 100644 --- a/include/ktls.h +++ b/include/ktls.h @@ -5,15 +5,21 @@ #ifdef N64_DSO __asm__ ( + ".ifndef __RDHWR_WAS_DEFINED" "\n" ".macro rdhwr rt, rd" "\n" " .error \" Usage of thread-local variables is not supported in DSOs. \"" "\n" ".endm" "\n" + ".set __RDHWR_WAS_DEFINED, 1" "\n" + ".endif" "\n" ); #else __asm__ ( + ".ifndef __RDHWR_WAS_DEFINED" "\n" ".macro rdhwr rt, rd" "\n" " lw \\rt, %gprel(th_cur_tp)($gp)" "\n" ".endm" "\n" + ".set __RDHWR_WAS_DEFINED, 1" "\n" + ".endif" "\n" ); #endif