Skip to content

Commit 43fbd46

Browse files
committed
opal/patch: add call to check if binary patching is supported
Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 40e6e3a commit 43fbd46

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

opal/mca/memory/patcher/memory_patcher_component.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ static int patcher_register (void)
241241

242242
static int patcher_query (int *priority)
243243
{
244-
*priority = mca_memory_patcher_priority;
244+
if (opal_patch_supported ()) {
245+
*priority = mca_memory_patcher_priority;
246+
} else {
247+
*priority = -1;
248+
}
245249
return OPAL_SUCCESS;
246250
}
247251

opal/util/opal_patcher.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ int opal_patch_symbol (const char *func_symbol_name, uintptr_t func_new_addr)
195195
return OPAL_SUCCESS;
196196
}
197197

198+
bool opal_patch_supported (void)
199+
{
200+
return true;
201+
}
202+
198203
/* end of #if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) */
199204
// ------------------------------------------------- PPC equivalent:
200205
#elif defined(__PPC__)
@@ -338,10 +343,20 @@ int opal_patch_symbol (const char *sys_func, uintptr_t hook_addr)
338343
return OPAL_SUCCESS;
339344
}
340345

346+
bool opal_patch_supported (void)
347+
{
348+
return true;
349+
}
341350
#else
342351

343-
int opal_patch_symbol (const char *sys_func, uintptr_t hook_addr) {
352+
int opal_patch_symbol (const char *sys_func, uintptr_t hook_addr)
353+
{
344354
return OPAL_ERR_NOT_SUPPORTED;
345355
}
346356

357+
bool opal_patch_supported (void)
358+
{
359+
return false;
360+
}
361+
347362
#endif

opal/util/opal_patcher.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,9 @@
5353
*/
5454
int opal_patch_symbol (const char *func_symbol_name, uintptr_t func_new_addr);
5555

56+
/**
57+
* Check if symbol patching is available
58+
*/
59+
bool opal_patch_supported (void);
5660

5761
#endif /* !defined(OPAL_PATCHER_H) */

0 commit comments

Comments
 (0)