Kingcom / armips

An assembler for various ARM and MIPS platforms. Builds available at http://buildbot.orphis.net/armips/
MIT License
363 stars 77 forks source link

.autoregion broken on latest version of armips. #206

Closed Gh0stBlade closed 3 years ago

Gh0stBlade commented 3 years ago

.org BASE_ADDRESS+0x1AE180 .region 0x2DC6C0, 0x0 .asciiz "START_TRAE_PATCH" .endregion

.autoregion .importobj "FRMain\Psp\FRMainPSP.o" .endautoregion

This piece effectively is supposed to define a region between 0x1AE180 and 0x1AE180 + 0x2DC6C0 which it seems to do correctly. However, the ".autoregion" seems to write past the end of the region!

unknownbrackets commented 3 years ago

To be clear, did this previously work (i.e. before #205), or are you not sure if this ever worked? These allocated regions are new, it's possible they have interacted with importobj incorrectly from the start.

In this example, how big is the object? How much data is inserted? You can log this by checking .notice toHex(org(), 16) before and after the .importobj ....

-[Unknown]

Gh0stBlade commented 3 years ago

Ok so upon further investigation, I have managed to solve this issue. The solution simply stores the value of org() in a label and sets the .org back to that old value after .org is changed in one of my includes. This is what appeared to be causing glitches within armips latest version (i changed org to patch a function but didn't restore it whilst it was inside .autoregion). It seems that the older versions of armips prior to #205 did not require this type of solution but i'll stick with it anyway.

unknownbrackets commented 3 years ago

I suppose we could issue a warning if you try to change org inside an autoregion... restoring it ought to be fine, but leaving it changed ought to have broken things before too.

-[Unknown]