From 203ceaf717d98ddcec86e9a1df1aef2ac2fadeae Mon Sep 17 00:00:00 2001 From: James Dansereau <106631954+jkdansereau@users.noreply.github.com> Date: Thu, 3 Sep 2026 09:59:50 -0400 Subject: [PATCH] port: fix linux-build link error in optionsoverlay (_SHIFTL) gbi.h's gDP* DL macros use _SHIFTL/_SHIFTR without defining them; game TUs pull them in via . This is the first port/src TU to build a display list, and on GCC/ld the missing macro became an undefined symbol (MinGW's include chain happens to provide it). Define the two pure macros locally, verbatim from PR/mbi.h -- including mbi.h itself drags in N64 OS headers that shadow libc. --- port/src/optionsoverlay.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/port/src/optionsoverlay.c b/port/src/optionsoverlay.c index a195f1a6..018412dc 100644 --- a/port/src/optionsoverlay.c +++ b/port/src/optionsoverlay.c @@ -22,6 +22,15 @@ #include #include +/* gbi.h's gDP* DL macros use _SHIFTL/_SHIFTR but do not define them -- game TUs + * get them from /, which also drags in N64 OS headers that + * shadow libc here. Define the two pure macros locally (verbatim from mbi.h) so + * this stays a plain port TU. Without them GCC/ld fails "undefined reference to + * _SHIFTL" (MinGW's chain happens to provide it). */ +#ifndef _SHIFTL +#define _SHIFTL(v, s, w) ((u32)(((u32)(v) & ((0x01 << (w)) - 1)) << (s))) +#define _SHIFTR(v, s, w) ((u32)(((u32)(v) >> (s)) & ((0x01 << (w)) - 1))) +#endif #include #include "platform.h"