Skip to content

Commit

Permalink
Merge pull request eclipse-omr#7079 from dsouzai/fixPPC32Crash
Browse files Browse the repository at this point in the history
Fix Crashes in 32-bit PPC due to incorrect relocation initialization
  • Loading branch information
0xdaryl authored Jul 31, 2023
2 parents f95ba19 + 40c2f62 commit fc53a4c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
14 changes: 14 additions & 0 deletions compiler/codegen/Relocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,20 @@ TR::ExternalOrderedPair32BitRelocation::ExternalOrderedPair32BitRelocation(
setTargetKind(k);
}

TR::ExternalOrderedPair32BitRelocation::ExternalOrderedPair32BitRelocation(
uint8_t *location1,
uint8_t *location2,
uint8_t *target,
uint8_t *target2,
TR_ExternalRelocationTargetKind k,
TR::CodeGenerator *cg) :
TR::ExternalRelocation(), _update2Location(location2)
{
setUpdateLocation(location1);
setTargetAddress(target);
setTargetAddress2(target2);
setTargetKind(k);
}

uint8_t TR::ExternalOrderedPair32BitRelocation::collectModifier()
{
Expand Down
18 changes: 13 additions & 5 deletions compiler/codegen/Relocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,14 @@ class ExternalRelocation : public TR::Relocation
_relocationRecord(NULL)
{}

uint8_t *getTargetAddress() {return _targetAddress;}
uint8_t *setTargetAddress(uint8_t *p) {return (_targetAddress = p);}
uint8_t *getTargetAddress() { return _targetAddress; }
uint8_t *setTargetAddress(uint8_t *p) { return (_targetAddress = p); }

uint8_t *getTargetAddress2() {return _targetAddress2;}
uint8_t *getTargetAddress2() { return _targetAddress2; }
uint8_t *setTargetAddress2(uint8_t *p) { return (_targetAddress2 = p); }

TR_ExternalRelocationTargetKind getTargetKind() {return _kind;}
TR_ExternalRelocationTargetKind setTargetKind(TR_ExternalRelocationTargetKind k) {return (_kind = k);}
TR_ExternalRelocationTargetKind getTargetKind() { return _kind; }
TR_ExternalRelocationTargetKind setTargetKind(TR_ExternalRelocationTargetKind k) { return (_kind = k); }

TR::IteratedExternalRelocation *getRelocationRecord()
{return _relocationRecord;}
Expand Down Expand Up @@ -459,6 +460,13 @@ class ExternalOrderedPair32BitRelocation: public TR::ExternalRelocation
TR_ExternalRelocationTargetKind k,
TR::CodeGenerator *cg);

ExternalOrderedPair32BitRelocation(uint8_t *location1,
uint8_t *location2,
uint8_t *target,
uint8_t *target2,
TR_ExternalRelocationTargetKind k,
TR::CodeGenerator *cg);

uint8_t *getLocation2() {return _update2Location;}
void setLocation2(uint8_t *l) {_update2Location = l;}

Expand Down
1 change: 1 addition & 0 deletions compiler/p/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,7 @@ OMR::Power::CodeGenerator::addMetaDataForLoadIntConstantFixed(
else if (typeAddress == TR_MethodEnterExitHookAddress)
{
self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalOrderedPair32BitRelocation((uint8_t *)firstInstruction,
(uint8_t *)secondInstruction,
(uint8_t *)node->getSymbolReference(),
(uint8_t *)orderedPairSequence2,
(TR_ExternalRelocationTargetKind)TR_MethodEnterExitHookAddress, self()),
Expand Down

0 comments on commit fc53a4c

Please sign in to comment.