linux-runtime: BUNKER1 boots + renders on Linux

First runtime bring-up on Linux (Ubuntu, gcc-14). -level_09 now renders
past frame 1200 crash-free with a clean shutdown, matching Windows.

- port/src/romdata.c: no-PIE loads the image at 0x400000, so the D34
  'clear low 32 bits of a symbol address' gives 0 -> false 'image base not
  4GiB-aligned' abort. The ANIM_DATA_* lvalues are only ever address-taken
  (never dereferenced), so fall back to a fixed 4GiB-aligned sentinel
  (0x100000000) for g_pc_animdata_base.
- port/src/main.c: the 'image must load at 0x140000000' assertion is
  PE-specific (.refptr base relocations); ELF no-PIE resolves dram_syms.s
  absolute symbols literally regardless of load address. Guard it to
  PLATFORM_WINDOWS.
- port/src/libultra.c: mmap game-thread stacks with MAP_32BIT so they sit
  in the low 2GiB. The decomp truncates stack-buffer pointers to u32 (e.g.
   in texLoad); glibc pthread stacks live above 4GiB and
  those truncations corrupt. One fix covers the whole idiom class. Windows
  pthread stacks are already low.
- src/game/image.c: belt-and-braces #ifdef PORT -- align compbuffer at
  uintptr_t width (identical result on N64).
- CMakeLists.txt: drop the -Ttext-segment experiment (needs -mcmodel=large;
  breaks R_X86_64_32 relocs) -- comment only.

Windows: build 240/241, -level_09 crash-free past frame 1440.
This commit is contained in:
James Dansereau committed 2026-09-02 22:50:56 -04:00
1 parent 875b3c7653
commit fe3d543647
5 files changed
+53 -4

No files matched your search

+7
View File
@@ -2435,7 +2435,14 @@ void texLoad(s32 *updateword, struct texpool *pool)
if (tex == NULL)
{
#ifdef PORT
/* compbuffer is a stack array; (u32) truncates the 64-bit host stack
* address (glibc pthread stacks live above 4GiB). Align at full
* pointer width -- same result on N64, correct on the port. */
alignedcompbuffer = (u8 *) (((uintptr_t)compbuffer + 0xF) & ~(uintptr_t)0xF);
#else
alignedcompbuffer = (u8 *) (((u32)compbuffer + 0xF) >> 4 << 4);
#endif
if (alignedcompbuffer);
if (tex);