From 10e00addae098da5d0a7cc0cee4455e9339a5ef7 Mon Sep 17 00:00:00 2001 From: Irwin D'Souza Date: Wed, 3 May 2023 14:24:28 -0400 Subject: [PATCH 1/4] Clean up the relocation flags Signed-off-by: Irwin D'Souza --- compiler/codegen/Relocation.cpp | 4 ++-- compiler/codegen/Relocation.hpp | 4 ++-- compiler/runtime/Runtime.hpp | 21 +++++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/compiler/codegen/Relocation.cpp b/compiler/codegen/Relocation.cpp index ce349fe183..b5b3acb6bc 100644 --- a/compiler/codegen/Relocation.cpp +++ b/compiler/codegen/Relocation.cpp @@ -322,9 +322,9 @@ uint8_t TR::ExternalOrderedPair32BitRelocation::collectModifier() int32_t iLoc2 = static_cast(updateLocation2 - relocatableMethodCodeStart); if ( (iLoc < MIN_SHORT_OFFSET || iLoc > MAX_SHORT_OFFSET ) || (iLoc2 < MIN_SHORT_OFFSET || iLoc2 > MAX_SHORT_OFFSET ) ) - return RELOCATION_TYPE_WIDE_OFFSET | RELOCATION_TYPE_ORDERED_PAIR; + return RELOCATION_TYPE_WIDE_OFFSET | ITERATED_RELOCATION_TYPE_ORDERED_PAIR; - return RELOCATION_TYPE_ORDERED_PAIR; + return ITERATED_RELOCATION_TYPE_ORDERED_PAIR; } diff --git a/compiler/codegen/Relocation.hpp b/compiler/codegen/Relocation.hpp index ce8ba9ca9c..7aa17433f2 100644 --- a/compiler/codegen/Relocation.hpp +++ b/compiler/codegen/Relocation.hpp @@ -307,8 +307,8 @@ class IteratedExternalRelocation : public TR_Link Date: Wed, 3 May 2023 14:48:53 -0400 Subject: [PATCH 2/4] Move cross platform relo flags to the lower nibble Signed-off-by: Irwin D'Souza --- compiler/runtime/Runtime.hpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/runtime/Runtime.hpp b/compiler/runtime/Runtime.hpp index e569f96992..ed5d8b6e2d 100644 --- a/compiler/runtime/Runtime.hpp +++ b/compiler/runtime/Runtime.hpp @@ -187,17 +187,20 @@ inline TR_LinkageConventions runtimeHelperLinkage(TR_RuntimeHelper h) { return r // Relocation flags and masks typedef enum { - ITERATED_RELOCATION_TYPE_ORDERED_PAIR = 0x20, + RELOCATION_TYPE_EIP_OFFSET = 0x1, + RELOCATION_TYPE_WIDE_OFFSET = 0x2, - RELOCATION_TYPE_EIP_OFFSET = 0x40, - RELOCATION_TYPE_WIDE_OFFSET = 0x80, + ITERATED_RELOCATION_TYPE_ORDERED_PAIR = 0x4, // ITERATED_RELOCATION_TYPE_ORDERED_PAIR is not stored in the binary template // as the isOrderedPairRelocation API is used to determine whether a given // relocation is an Orderd Pair Relocation or not. RELOCATION_CROSS_PLATFORM_FLAGS_MASK = (RELOCATION_TYPE_EIP_OFFSET | RELOCATION_TYPE_WIDE_OFFSET), + RELOCATION_RELOC_FLAGS_MASK = (~RELOCATION_CROSS_PLATFORM_FLAGS_MASK), - } TR_RelocationCrossPlatformMask; + RELOCATION_RELOC_FLAGS_SHIFT = 4, + + } TR_RelocationFlagUtilities; // These macros are intended for use when HI_VALUE and LO_VALUE will be recombined after LO_VALUE is sign-extended // (e.g. when LO_VALUE is used with an instruction that takes a signed 16-bit operand). From 997fd5c4767fd557441cc30a08e189d85292fa0a Mon Sep 17 00:00:00 2001 From: Irwin D'Souza Date: Fri, 5 May 2023 14:20:53 -0400 Subject: [PATCH 3/4] Add enter/exit hook address flags in TR::Symbol Signed-off-by: Irwin D'Souza --- compiler/il/OMRSymbol.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/il/OMRSymbol.hpp b/compiler/il/OMRSymbol.hpp index 303dba3533..96d4babac9 100644 --- a/compiler/il/OMRSymbol.hpp +++ b/compiler/il/OMRSymbol.hpp @@ -293,6 +293,12 @@ class OMR_EXTENSIBLE Symbol void setIsCatchBlockCounter() { _flags2.set(CatchBlockCounter); } bool isCatchBlockCounter() { return _flags2.testAny(CatchBlockCounter); } + void setIsEnterEventHookAddress() { _flags2.set(EnterEventHookAddress); } + bool isEnterEventHookAddress() { return _flags2.testAny(EnterEventHookAddress); } + + void setIsExitEventHookAddress() { _flags2.set(ExitEventHookAddress); } + bool isExitEventHookAddress() { return _flags2.testAny(ExitEventHookAddress); } + inline bool isNamed(); // flag methods specific to Autos @@ -600,6 +606,8 @@ class OMR_EXTENSIBLE Symbol */ StaticDefaultValueInstance = 0x00020000, CatchBlockCounter = 0x00040000, + EnterEventHookAddress = 0x00080000, + ExitEventHookAddress = 0x00100000, }; protected: From 50cffa9087aea37ef5b603b5b0dcb9dc59c9ac2a Mon Sep 17 00:00:00 2001 From: Irwin D'Souza Date: Thu, 8 Jun 2023 15:36:48 -0400 Subject: [PATCH 4/4] Add Method Enter/Exit Hook Address Relocation Signed-off-by: Irwin D'Souza --- .../aarch64/codegen/OMRMemoryReference.cpp | 4 ++ compiler/aarch64/codegen/OMRTreeEvaluator.cpp | 10 ++++ compiler/arm/codegen/OMRMemoryReference.cpp | 4 ++ compiler/arm/codegen/OMRTreeEvaluator.cpp | 14 +++++ compiler/codegen/Relocation.cpp | 5 +- compiler/p/codegen/OMRCodeGenerator.cpp | 18 ++++++ compiler/p/codegen/OMRMemoryReference.cpp | 17 +++++- compiler/runtime/Runtime.hpp | 4 +- .../x/amd64/codegen/OMRMemoryReference.cpp | 16 ++++++ compiler/x/codegen/OMRMemoryReference.cpp | 13 +++++ compiler/x/codegen/OMRX86Instruction.cpp | 6 ++ compiler/x/codegen/X86BinaryEncoding.cpp | 56 +++++++++++++++++++ compiler/z/codegen/ConstantDataSnippet.cpp | 15 +++++ compiler/z/codegen/OMRTreeEvaluator.cpp | 12 ++++ 14 files changed, 188 insertions(+), 6 deletions(-) diff --git a/compiler/aarch64/codegen/OMRMemoryReference.cpp b/compiler/aarch64/codegen/OMRMemoryReference.cpp index 3c129e8501..86cfa80eef 100644 --- a/compiler/aarch64/codegen/OMRMemoryReference.cpp +++ b/compiler/aarch64/codegen/OMRMemoryReference.cpp @@ -114,6 +114,10 @@ static void loadRelocatableConstant(TR::Node *node, { loadAddressConstant(cg, true, GCRnode, (intptr_t)ref, reg, NULL, TR_ClassAddress); } + else if (symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) + { + loadAddressConstant(cg, true, GCRnode, 1, reg, NULL, TR_MethodEnterExitHookAddress); + } else { loadConstant64(cg, node, addr, reg); diff --git a/compiler/aarch64/codegen/OMRTreeEvaluator.cpp b/compiler/aarch64/codegen/OMRTreeEvaluator.cpp index 4d15e3e9de..4e72b974a9 100644 --- a/compiler/aarch64/codegen/OMRTreeEvaluator.cpp +++ b/compiler/aarch64/codegen/OMRTreeEvaluator.cpp @@ -5926,6 +5926,16 @@ addMetaDataForLoadAddressConstantFixed(TR::CodeGenerator *cg, TR::Node *node, TR } break; } + + case TR_MethodEnterExitHookAddress: + { + relo = new (cg->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation( + firstInstruction, + (uint8_t *)node->getSymbolReference(), + NULL, + TR_MethodEnterExitHookAddress, cg); + break; + } } if (!relo) diff --git a/compiler/arm/codegen/OMRMemoryReference.cpp b/compiler/arm/codegen/OMRMemoryReference.cpp index cdae8a41ad..580e1459c6 100644 --- a/compiler/arm/codegen/OMRMemoryReference.cpp +++ b/compiler/arm/codegen/OMRMemoryReference.cpp @@ -1383,6 +1383,10 @@ static void loadRelocatableConstant(TR::Node *node, { loadAddressConstant(cg, GCRnode, 1, reg, NULL, false, TR_DataAddress); } + else if (symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) + { + loadAddressConstant(cg, GCRnode, 1, reg, NULL, false, TR_MethodEnterExitHookAddress); + } else { cg->addSnippet(mr->setUnresolvedSnippet(new (cg->trHeapMemory()) TR::UnresolvedDataSnippet(cg, node, ref, node->getOpCode().isStore(), false))); diff --git a/compiler/arm/codegen/OMRTreeEvaluator.cpp b/compiler/arm/codegen/OMRTreeEvaluator.cpp index 726c1fe211..422abdbf08 100644 --- a/compiler/arm/codegen/OMRTreeEvaluator.cpp +++ b/compiler/arm/codegen/OMRTreeEvaluator.cpp @@ -3106,6 +3106,20 @@ TR::Instruction *loadAddressConstantFixed(TR::CodeGenerator *cg, TR::Node * node node); } } + else if (typeAddress == TR_MethodEnterExitHookAddress) + { + if (doAOTRelocation) + { + cg->addExternalRelocation(new (cg->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation( + cursor, + (uint8_t *)node->getSymbolReference(), + (uint8_t *)seqKind, + (TR_ExternalRelocationTargetKind)typeAddress, cg), + __FILE__, + __LINE__, + node); + } + } else { if (doAOTRelocation) diff --git a/compiler/codegen/Relocation.cpp b/compiler/codegen/Relocation.cpp index b5b3acb6bc..e648c7aefc 100644 --- a/compiler/codegen/Relocation.cpp +++ b/compiler/codegen/Relocation.cpp @@ -305,7 +305,7 @@ uint8_t TR::ExternalOrderedPair32BitRelocation::collectModifier() if (comp->target().cpu.isPower() && (kind == TR_ArrayCopyHelper || kind == TR_ArrayCopyToc || kind == TR_RamMethod || kind == TR_GlobalValue || kind == TR_BodyInfoAddressLoad || kind == TR_DataAddress - || kind == TR_DebugCounter || kind == TR_BlockFrequency || kind == TR_RecompQueuedFlag || kind == TR_CatchBlockCounter)) + || kind == TR_DebugCounter || kind == TR_BlockFrequency || kind == TR_RecompQueuedFlag || kind == TR_CatchBlockCounter || kind == TR_MethodEnterExitHookAddress)) { TR::Instruction *instr = (TR::Instruction *)getUpdateLocation(); TR::Instruction *instr2 = (TR::Instruction *)getLocation2(); @@ -337,7 +337,7 @@ void TR::ExternalOrderedPair32BitRelocation::apply(TR::CodeGenerator *cg) TR_ExternalRelocationTargetKind kind = getRelocationRecord()->getTargetKind(); if (comp->target().cpu.isPower() && (kind == TR_ArrayCopyHelper || kind == TR_ArrayCopyToc || kind == TR_RamMethodSequence || kind == TR_GlobalValue || kind == TR_BodyInfoAddressLoad || kind == TR_DataAddress - || kind == TR_DebugCounter || kind == TR_BlockFrequency || kind == TR_RecompQueuedFlag || kind == TR_CatchBlockCounter)) + || kind == TR_DebugCounter || kind == TR_BlockFrequency || kind == TR_RecompQueuedFlag || kind == TR_CatchBlockCounter || kind == TR_MethodEnterExitHookAddress)) { TR::Instruction *instr = (TR::Instruction *)getUpdateLocation(); TR::Instruction *instr2 = (TR::Instruction *)getLocation2(); @@ -469,6 +469,7 @@ const char *TR::ExternalRelocation::_externalRelocationTargetKindNames[TR_NumExt "TR_ValidateIsClassVisible (112)", "TR_CatchBlockCounter (113)", "TR_StartPC (114)", + "TR_MethodEnterExitHookAddress (115)", }; uintptr_t TR::ExternalRelocation::_globalValueList[TR_NumGlobalValueItems] = diff --git a/compiler/p/codegen/OMRCodeGenerator.cpp b/compiler/p/codegen/OMRCodeGenerator.cpp index 1c23294515..a8df425536 100644 --- a/compiler/p/codegen/OMRCodeGenerator.cpp +++ b/compiler/p/codegen/OMRCodeGenerator.cpp @@ -1987,6 +1987,16 @@ OMR::Power::CodeGenerator::addMetaDataForLoadAddressConstantFixed( value = (uintptr_t)node->getSymbolReference(); break; } + + case TR_MethodEnterExitHookAddress: + { + relo = new (self()->trHeapMemory()) TR::BeforeBinaryEncodingExternalRelocation( + firstInstruction, + (uint8_t *)node->getSymbolReference(), + (uint8_t *)seqKind, + TR_MethodEnterExitHookAddress, self()); + break; + } } if (comp->getOption(TR_UseSymbolValidationManager) && !relo) @@ -2153,6 +2163,14 @@ OMR::Power::CodeGenerator::addMetaDataForLoadIntConstantFixed( (TR_ExternalRelocationTargetKind)typeAddress, self()), __FILE__, __LINE__, node); } + else if (typeAddress == TR_MethodEnterExitHookAddress) + { + self()->addExternalRelocation(new (self()->trHeapMemory()) TR::ExternalOrderedPair32BitRelocation((uint8_t *)firstInstruction, + (uint8_t *)node->getSymbolReference(), + (uint8_t *)orderedPairSequence2, + (TR_ExternalRelocationTargetKind)TR_MethodEnterExitHookAddress, self()), + __FILE__, __LINE__, node); + } else if (typeAddress != -1) { TR_RelocationRecordInformation *recordInfo = ( TR_RelocationRecordInformation *)comp->trMemory()->allocateMemory(sizeof( TR_RelocationRecordInformation), heapAlloc); diff --git a/compiler/p/codegen/OMRMemoryReference.cpp b/compiler/p/codegen/OMRMemoryReference.cpp index e39d1970b2..0e28732738 100644 --- a/compiler/p/codegen/OMRMemoryReference.cpp +++ b/compiler/p/codegen/OMRMemoryReference.cpp @@ -1490,7 +1490,7 @@ TR::Instruction *OMR::Power::MemoryReference::expandInstruction(TR::Instruction cg, TR::InstOpCode::Op_st, node, - TR::MemoryReference::createWithDisplacement(cg, stackPtr, -saveLen, saveLen), + TR::MemoryReference::createWithDisplacement(cg, stackPtr, -saveLen, saveLen), rX, prevInstruction ); @@ -1504,7 +1504,7 @@ TR::Instruction *OMR::Power::MemoryReference::expandInstruction(TR::Instruction TR::InstOpCode::Op_load, node, rX, - TR::MemoryReference::createWithDisplacement(cg, stackPtr, -saveLen, saveLen), + TR::MemoryReference::createWithDisplacement(cg, stackPtr, -saveLen, saveLen), currentInstruction ); } @@ -1632,6 +1632,12 @@ void OMR::Power::MemoryReference::accessStaticItem(TR::Node *node, TR::SymbolRef loadAddressConstant(cg, true, nodeForSymbol, 1, reg, NULL, false, TR_RecompQueuedFlag); return; } + else if ((symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) && cg->comp()->compileRelocatableCode()) + { + TR::Register *reg = _baseRegister = cg->allocateRegister(); + loadAddressConstant(cg, true, nodeForSymbol, 1, reg, NULL, false, TR_MethodEnterExitHookAddress); + return; + } else { TR_ASSERT_FATAL(!comp->getOption(TR_UseSymbolValidationManager) || ref->isUnresolved(), "SVM relocation unhandled"); @@ -1782,7 +1788,12 @@ void OMR::Power::MemoryReference::accessStaticItem(TR::Node *node, TR::SymbolRef loadAddressConstant(cg, true, nodeForSymbol, 1, reg, NULL, false, TR_RecompQueuedFlag); return; } - + else if ((symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) && cg->comp()->compileRelocatableCode()) + { + TR::Register *reg = _baseRegister = cg->allocateRegister(); + loadAddressConstant(cg, true, nodeForSymbol, 1, reg, NULL, false, TR_MethodEnterExitHookAddress); + return; + } else if (refIsUnresolved || useUnresSnippetToAvoidRelo) { self()->setUnresolvedSnippet(new (cg->trHeapMemory()) TR::UnresolvedDataSnippet(cg, node, ref, isStore, false)); diff --git a/compiler/runtime/Runtime.hpp b/compiler/runtime/Runtime.hpp index ed5d8b6e2d..48506e95e9 100644 --- a/compiler/runtime/Runtime.hpp +++ b/compiler/runtime/Runtime.hpp @@ -348,10 +348,12 @@ typedef enum TR_ValidateIsClassVisible = 112, TR_CatchBlockCounter = 113, TR_StartPC = 114, - TR_NumExternalRelocationKinds = 115, + TR_MethodEnterExitHookAddress = 115, + TR_NumExternalRelocationKinds = 116, TR_ExternalRelocationTargetKindMask = 0xff, } TR_ExternalRelocationTargetKind; + namespace TR { enum SymbolType diff --git a/compiler/x/amd64/codegen/OMRMemoryReference.cpp b/compiler/x/amd64/codegen/OMRMemoryReference.cpp index 6bf9aab38c..9cbae58cf6 100644 --- a/compiler/x/amd64/codegen/OMRMemoryReference.cpp +++ b/compiler/x/amd64/codegen/OMRMemoryReference.cpp @@ -570,6 +570,22 @@ OMR::X86::AMD64::MemoryReference::addMetaDataForCodeAddressWithLoad( counter); } } + else if (sr.getSymbol()->isEnterEventHookAddress() || sr.getSymbol()->isExitEventHookAddress()) + { + if (cg->needRelocationsForStatics()) + { + cg->addExternalRelocation( + TR::ExternalRelocation::create( + displacementLocation, + (uint8_t *)srCopy, + NULL, + TR_MethodEnterExitHookAddress, + cg), + __FILE__, + __LINE__, + containingInstruction->getNode()); + } + } } else { diff --git a/compiler/x/codegen/OMRMemoryReference.cpp b/compiler/x/codegen/OMRMemoryReference.cpp index 2c78751fc6..704fe346ba 100644 --- a/compiler/x/codegen/OMRMemoryReference.cpp +++ b/compiler/x/codegen/OMRMemoryReference.cpp @@ -1344,6 +1344,19 @@ OMR::X86::MemoryReference::addMetaDataForCodeAddress( node, counter); } + else if (symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) + { + cg->addExternalRelocation( + TR::ExternalRelocation::create( + cursor, + (uint8_t *)&self()->getSymbolReference(), + NULL, + TR_MethodEnterExitHookAddress, + cg), + __FILE__, + __LINE__, + node); + } else { cg->addExternalRelocation( diff --git a/compiler/x/codegen/OMRX86Instruction.cpp b/compiler/x/codegen/OMRX86Instruction.cpp index 8accd0742c..b4b1308aa3 100644 --- a/compiler/x/codegen/OMRX86Instruction.cpp +++ b/compiler/x/codegen/OMRX86Instruction.cpp @@ -1170,6 +1170,10 @@ TR::X86RegImmSymInstruction::autoSetReloKind() { setReloKind(TR_RecompQueuedFlag); } + else if (symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) + { + setReloKind(TR_MethodEnterExitHookAddress); + } } //////////////////////////////////////////////////////////////////////////////// @@ -4460,6 +4464,8 @@ TR::AMD64RegImm64SymInstruction::autoSetReloKind() setReloKind(TR_BlockFrequency); else if (symbol->isRecompQueuedFlag()) setReloKind(TR_RecompQueuedFlag); + else if (symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) + setReloKind(TR_MethodEnterExitHookAddress); else setReloKind(-1); } diff --git a/compiler/x/codegen/X86BinaryEncoding.cpp b/compiler/x/codegen/X86BinaryEncoding.cpp index 7a38419e26..de5bfc6234 100644 --- a/compiler/x/codegen/X86BinaryEncoding.cpp +++ b/compiler/x/codegen/X86BinaryEncoding.cpp @@ -1289,6 +1289,19 @@ TR::X86ImmSymInstruction::addMetaDataForCodeAddress(uint8_t *cursor) __LINE__, getNode()); } + else if (sym->isEnterEventHookAddress() || sym->isExitEventHookAddress()) + { + cg()->addExternalRelocation( + TR::ExternalRelocation::create( + cursor, + (uint8_t *)getSymbolReference(), + NULL, + TR_MethodEnterExitHookAddress, + cg()), + __FILE__, + __LINE__, + getNode()); + } else { cg()->addExternalRelocation( @@ -2117,6 +2130,21 @@ TR::X86RegImmSymInstruction::addMetaDataForCodeAddress(uint8_t *cursor) } break; + case TR_MethodEnterExitHookAddress: + { + cg()->addExternalRelocation( + TR::ExternalRelocation::create( + cursor, + (uint8_t *)getSymbolReference(), + NULL, + TR_MethodEnterExitHookAddress, + cg()), + __FILE__, + __LINE__, + getNode()); + } + break; + default: TR_ASSERT(0, "invalid relocation kind for TR::X86RegImmSymInstruction"); } @@ -2586,6 +2614,19 @@ TR::X86MemImmSymInstruction::addMetaDataForCodeAddress(uint8_t *cursor) __LINE__, getNode()); } + else if (symbol->isEnterEventHookAddress() || symbol->isExitEventHookAddress()) + { + cg()->addExternalRelocation( + TR::ExternalRelocation::create( + cursor, + (uint8_t *)getSymbolReference(), + NULL, + TR_MethodEnterExitHookAddress, + cg()), + __FILE__, + __LINE__, + getNode()); + } else { cg()->addExternalRelocation( @@ -3465,6 +3506,21 @@ TR::AMD64RegImm64SymInstruction::addMetaDataForCodeAddress(uint8_t *cursor) } break; + case TR_MethodEnterExitHookAddress: + { + cg()->addExternalRelocation( + TR::ExternalRelocation::create( + cursor, + (uint8_t *)getSymbolReference(), + NULL, + TR_MethodEnterExitHookAddress, + cg()), + __FILE__, + __LINE__, + getNode()); + } + break; + default: ; } diff --git a/compiler/z/codegen/ConstantDataSnippet.cpp b/compiler/z/codegen/ConstantDataSnippet.cpp index ba452b3edc..31ca1cdced 100644 --- a/compiler/z/codegen/ConstantDataSnippet.cpp +++ b/compiler/z/codegen/ConstantDataSnippet.cpp @@ -364,6 +364,21 @@ TR::S390ConstantDataSnippet::addMetaDataForCodeAddress(uint8_t *cursor) } break; + case TR_MethodEnterExitHookAddress: + { + cg()->addExternalRelocation( + TR::ExternalRelocation::create( + cursor, + (uint8_t *) getNode()->getSymbolReference(), + NULL, + TR_MethodEnterExitHookAddress, + cg()), + __FILE__, + __LINE__, + getNode()); + } + break; + default: TR_ASSERT( 0,"relocation type not handled yet"); } diff --git a/compiler/z/codegen/OMRTreeEvaluator.cpp b/compiler/z/codegen/OMRTreeEvaluator.cpp index 7a2badedd2..a29e812bee 100644 --- a/compiler/z/codegen/OMRTreeEvaluator.cpp +++ b/compiler/z/codegen/OMRTreeEvaluator.cpp @@ -2358,6 +2358,8 @@ getRelocationTargetKindFromSymbol(TR::CodeGenerator* cg, TR::Symbol *sym) reloKind = TR_RecompQueuedFlag; else if (cg->needRelocationsForBodyInfoData() && sym->isCatchBlockCounter()) reloKind = TR_CatchBlockCounter; + else if (cg->comp()->compileRelocatableCode() && (sym->isEnterEventHookAddress() || sym->isExitEventHookAddress())) + reloKind = TR_MethodEnterExitHookAddress; return reloKind; } @@ -8289,6 +8291,10 @@ OMR::Z::TreeEvaluator::checkAndSetMemRefDataSnippetRelocationType(TR::Node * nod { reloType = TR_RecompQueuedFlag; } + else if (cg->comp()->compileRelocatableCode() && (node->getSymbol()->isEnterEventHookAddress() || node->getSymbol()->isExitEventHookAddress())) + { + reloType = TR_MethodEnterExitHookAddress; + } if (reloType != 0) { @@ -11467,6 +11473,12 @@ OMR::Z::TreeEvaluator::loadaddrEvaluator(TR::Node * node, TR::CodeGenerator * cg (uintptr_t) node->getSymbol()->getStaticSymbol()->getStaticAddress(), TR_RecompQueuedFlag, NULL, NULL, NULL); } + else if (comp->compileRelocatableCode() && sym && (sym->isEnterEventHookAddress() || sym->isExitEventHookAddress())) + { + cursor = generateRegLitRefInstruction(cg, TR::InstOpCode::getLoadOpCode(), node, targetRegister, + (uintptr_t) node->getSymbol()->getStaticSymbol()->getStaticAddress(), + TR_MethodEnterExitHookAddress, NULL, NULL, NULL); + } else { cursor = genLoadAddressConstant(cg, node, (uintptr_t) node->getSymbol()->getStaticSymbol()->getStaticAddress(), targetRegister);