Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psyq-obj-parser: fix HI16 relocations with large addends #1653

Merged
merged 1 commit into from
May 16, 2024

Conversation

boricj
Copy link
Contributor

@boricj boricj commented May 13, 2024

There's a HI16/LO16 relocation pair with a large addend (>32767) inside the KanjiFntOpen() function within LIBGPU.LIB that isn't converted correctly by psyq-obj-parser, due to a bad serialization of the addend in the converted ELF object file.

Relocation with a large addend:

$ psyq-obj-parser KPRINTF.OBJ -o kprintf.o
    :: Generating relocation     HI16              .text::000001b8  .bss__base + 43024
      :: Skipped for this pass
    :: Generating relocation     LO16              .text::000001bc  .bss__base + 43024
      :: Skipped for this pass

Before fix:

$ mipsel-linux-gnu-objdump -dr kprintf.o
 1b8:   3c110100        lui     s1,0x100
                        1b8: R_MIPS_HI16        .bss
 1bc:   2631a810        addiu   s1,s1,-22512
                        1bc: R_MIPS_LO16        .bss

After fix:

$ mipsel-linux-gnu-objdump -dr kprintf.o
 1b8:   3c110001        lui     s1,0x1
                        1b8: R_MIPS_HI16        .bss
 1bc:   2631a810        addiu   s1,s1,-22512
                        1bc: R_MIPS_LO16        .bss

@nicolasnoble
Copy link
Member

Sorry, only seeing it now, isn't the same as #1557 ? I'll have a thorough look. I am behind on my fixes and stuff I need to do, sorry.

@nicolasnoble
Copy link
Member

Hah, it is NOT the same fix at all. Great, I have two bugs around hi16. Thanks!

@nicolasnoble nicolasnoble merged commit 6e5868d into grumpycoders:main May 16, 2024
15 checks passed
@boricj boricj deleted the bugfix/hi16lo16 branch May 16, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants