diff --git a/port/src/romdata.c b/port/src/romdata.c index 785f2d35..a034fa60 100644 --- a/port/src/romdata.c +++ b/port/src/romdata.c @@ -35,8 +35,7 @@ extern int snprintf(char *str, size_t maxsize, const char *format, ...); #else /* POSIX: mmap the ROM at the fixed cart address (mirrors the VirtualAlloc * path). is a host header the decomp include path does not - * shadow. */ - #include + * shadow. is included further down, after ultra64.h. */ #include #endif @@ -52,6 +51,15 @@ extern int snprintf(char *str, size_t maxsize, const char *format, ...); #include #include "bondtypes.h" +#if !defined(PLATFORM_WINDOWS) +/* Must come after ultra64.h: libc defines `errno` as a macro (glibc: + * `(*__errno_location ())`), which would rewrite the N64 `u8 errno;` + * fields in PR/os.h (OSContStatus, OSContPad, ...) into a function + * declaration and break the build ("field '__errno_location' declared as + * a function"). Only the mmap-failure diagnostic below reads errno. */ + #include +#endif + #define CART_BASE 0x10000000u static u8 *rom = NULL; /* heap copy (fallback path) */