devkitPro/buildscripts

Wii U RPXs cannot link to newlib due to lack of relocatability

shinyquagsire23 opened this issue · 1 comments

While Gamecube and Wii executables are largely static in terms of linking and memory, Wii U's executables are entirely position independent and are required to be.

In newlib's existing state, several functions (notably sprintf was tested) use jump tables with entries relative from it's own .rodata offset to the .text offset (ie target_jump_offset - jpt_rodata_offset). This does not work in an RPX since these relative offsets are never adjusted within RELA sections, and simply result in a prefetch abort.

One solution is to add -fno-jump-tables to dkppc/patches/newlib-2.0.0.patch, however this may have a performance impact on older systems and the Wii U. Optimally, the jump tables would just contain absolute addresses which are handled in the appropriate RELA sections, however I could not find any flags in GCC to do this.

-fno-jump-tables has been tested on hardware (source) and works through both loadiine and as an independent executable.

Non-issue with devkitPro/wut#43, closing. Tested on hardware and works so should be fine.