Skip to content

Commit

Permalink
Fix TLS under LTO
Browse files Browse the repository at this point in the history
Fixes build of N64 flashcart menu
  • Loading branch information
gamemasterplc authored and rasky committed Oct 12, 2024
1 parent 7387ccd commit 783f400
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/ktls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 783f400

Please sign in to comment.