1
1

opal/patch: add call to check if binary patching is supported

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
Nathan Hjelm 2016-03-25 14:08:37 -06:00 коммит произвёл Nathan Hjelm
родитель 11e2d7886e
Коммит 4cac623aeb
3 изменённых файлов: 25 добавлений и 2 удалений

Просмотреть файл

@ -241,7 +241,11 @@ static int patcher_register (void)
static int patcher_query (int *priority)
{
*priority = mca_memory_patcher_priority;
if (opal_patch_supported ()) {
*priority = mca_memory_patcher_priority;
} else {
*priority = -1;
}
return OPAL_SUCCESS;
}

Просмотреть файл

@ -195,6 +195,11 @@ int opal_patch_symbol (const char *func_symbol_name, uintptr_t func_new_addr)
return OPAL_SUCCESS;
}
bool opal_patch_supported (void)
{
return true;
}
/* end of #if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) */
// ------------------------------------------------- PPC equivalent:
#elif OPAL_ENABLE_DLOPEN_SUPPORT && defined(__PPC__)
@ -338,10 +343,20 @@ int opal_patch_symbol (const char *sys_func, uintptr_t hook_addr)
return OPAL_SUCCESS;
}
bool opal_patch_supported (void)
{
return true;
}
#else
int opal_patch_symbol (const char *sys_func, uintptr_t hook_addr) {
int opal_patch_symbol (const char *sys_func, uintptr_t hook_addr)
{
return OPAL_ERR_NOT_SUPPORTED;
}
bool opal_patch_supported (void)
{
return false;
}
#endif

Просмотреть файл

@ -53,5 +53,9 @@
*/
int opal_patch_symbol (const char *func_symbol_name, uintptr_t func_new_addr);
/**
* Check if symbol patching is available
*/
bool opal_patch_supported (void);
#endif /* !defined(OPAL_PATCHER_H) */