ethteck / splat

A binary splitting tool to assist with decompilation and modding projects
MIT License
170 stars 43 forks source link

Make %gp_rel access configurable between asm and nonmatchings asm #391

Closed mkst closed 3 months ago

mkst commented 3 months ago

For projects compiled with a non-zero -G value, the $gp register can be used to access symbols defined and within the current TU, that are smaller than the -G limit.

For asm segments, the accesses are wrapped in the %gp_rel() which is great, as these files are usually compiled with as from modern binutils. However when projects use INCLUDE_ASM macros to include assembly snippets, the %gp_rel() macro trips up the old assemblers and so compilation fails.

These projects are currently grep-ing/sed-ing through the nonmatching/asm/... files to remove the macro. It would be better if the use of the %gp_rel() macro could be configured and turned on and off. I believe there is currently something around %gp_rel() when the compiler is set to SN64, but I would need to look at the code to remind myself.

Potential naming (better suggestions are appreciated!)

options:
  use_gp_rel_macro_asm: yes  # default yes
  use_gp_rel_macro_nonmatching_asm: no  # default yes