devkitPro / wut

Let's try to make a Wii U Toolchain / SDK for creating rpx/rpl.
zlib License
236 stars 52 forks source link

Add wut_load_bounds section to prevent loader bug #220

Closed GaryOderNichts closed 2 years ago

GaryOderNichts commented 2 years ago

The CafeOS loader skips import sections when calculating the lower bounds of loader info (see decaf-emu). This ends up using symtab for the lower bound which comes after the imports, resulting in a negative offset here.

This PR adds a dummy section (which is not using the import type) before the imports in loadmem, which makes sure the lower bounds stay correct.

exjam commented 2 years ago

Good job finding this bug !