Skip to content

Commit

Permalink
Merge pull request #1557 from nicolasnoble/psyq-parser-hi16-adjust
Browse files Browse the repository at this point in the history
Properly adjusting hi16's addend relocation.
  • Loading branch information
nicolasnoble authored May 16, 2024
2 parents 6e5868d + 927de41 commit be89961
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/psyq-obj-parser/psyq-obj-parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,10 @@ bool PsyqLnkFile::Relocation::generateElf(ElfRelocationPass pass, const std::str
uint8_t* sectionData = (uint8_t*)malloc(size);
memcpy(sectionData, section->section->get_data(), size);
fmt::print(" :: Altering bytestream to account for HI symbol+addend relocation\n");
if (addend < 0) {
fmt::print(" :: Adjusting for negative addend\n");
addend += 0x10000;
}
addend >>= 16;
sectionData[offset + 0] = addend & 0xff;
addend >>= 8;
Expand Down

0 comments on commit be89961

Please sign in to comment.