尝试支持clang关闭优化
This commit is contained in:
@@ -44,10 +44,20 @@
|
|||||||
#include "kpm.h"
|
#include "kpm.h"
|
||||||
#include "compact.h"
|
#include "compact.h"
|
||||||
|
|
||||||
|
#ifndef NO_OPTIMIZE
|
||||||
|
#if defined(__GNUC__) && !defined(__clang__)
|
||||||
|
#define NO_OPTIMIZE __attribute__((optimize("O0")))
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#define NO_OPTIMIZE __attribute__((optnone))
|
||||||
|
#else
|
||||||
|
#define NO_OPTIMIZE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// ============================================================================================
|
// ============================================================================================
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_kpm_load_module_path(const char* path, const char* args, void* ptr) {
|
int sukisu_kpm_load_module_path(const char* path, const char* args, void* ptr) {
|
||||||
// This is a KPM module stub.
|
// This is a KPM module stub.
|
||||||
printk("KPM: Stub function called (sukisu_kpm_load_module_path). path=%s args=%s ptr=%p\n", path, args, ptr);
|
printk("KPM: Stub function called (sukisu_kpm_load_module_path). path=%s args=%s ptr=%p\n", path, args, ptr);
|
||||||
@@ -55,7 +65,7 @@ int sukisu_kpm_load_module_path(const char* path, const char* args, void* ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_kpm_unload_module(const char* name, void* ptr) {
|
int sukisu_kpm_unload_module(const char* name, void* ptr) {
|
||||||
// This is a KPM module stub.
|
// This is a KPM module stub.
|
||||||
printk("KPM: Stub function called (sukisu_kpm_unload_module). name=%s ptr=%p\n", name, ptr);
|
printk("KPM: Stub function called (sukisu_kpm_unload_module). name=%s ptr=%p\n", name, ptr);
|
||||||
@@ -63,7 +73,7 @@ int sukisu_kpm_unload_module(const char* name, void* ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_kpm_num(void) {
|
int sukisu_kpm_num(void) {
|
||||||
// This is a KPM module stub.
|
// This is a KPM module stub.
|
||||||
printk("KPM: Stub function called (sukisu_kpm_num).\n");
|
printk("KPM: Stub function called (sukisu_kpm_num).\n");
|
||||||
@@ -71,7 +81,7 @@ int sukisu_kpm_num(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_kpm_info(const char* name, void __user* out) {
|
int sukisu_kpm_info(const char* name, void __user* out) {
|
||||||
// This is a KPM module stub.
|
// This is a KPM module stub.
|
||||||
printk("KPM: Stub function called (sukisu_kpm_info). name=%s buffer=%p\n", name, out);
|
printk("KPM: Stub function called (sukisu_kpm_info). name=%s buffer=%p\n", name, out);
|
||||||
@@ -79,7 +89,7 @@ int sukisu_kpm_info(const char* name, void __user* out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_kpm_list(void __user* out, unsigned int bufferSize) {
|
int sukisu_kpm_list(void __user* out, unsigned int bufferSize) {
|
||||||
// This is a KPM module stub.
|
// This is a KPM module stub.
|
||||||
printk("KPM: Stub function called (sukisu_kpm_list). buffer=%p size=%d\n", out, bufferSize);
|
printk("KPM: Stub function called (sukisu_kpm_list). buffer=%p size=%d\n", out, bufferSize);
|
||||||
@@ -87,7 +97,7 @@ int sukisu_kpm_list(void __user* out, unsigned int bufferSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_kpm_control(void __user* name, void __user* args) {
|
int sukisu_kpm_control(void __user* name, void __user* args) {
|
||||||
// This is a KPM module stub.
|
// This is a KPM module stub.
|
||||||
printk("KPM: Stub function called (sukisu_kpm_control). name=%p args=%p\n", name, args);
|
printk("KPM: Stub function called (sukisu_kpm_control). name=%p args=%p\n", name, args);
|
||||||
@@ -95,7 +105,7 @@ int sukisu_kpm_control(void __user* name, void __user* args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_kpm_version(void __user* out, unsigned int bufferSize) {
|
int sukisu_kpm_version(void __user* out, unsigned int bufferSize) {
|
||||||
// This is a KPM module stub.
|
// This is a KPM module stub.
|
||||||
printk("KPM: Stub function called (sukisu_kpm_version). buffer=%p size=%d\n", out, bufferSize);
|
printk("KPM: Stub function called (sukisu_kpm_version). buffer=%p size=%d\n", out, bufferSize);
|
||||||
@@ -111,7 +121,7 @@ EXPORT_SYMBOL(sukisu_kpm_version);
|
|||||||
EXPORT_SYMBOL(sukisu_kpm_control);
|
EXPORT_SYMBOL(sukisu_kpm_control);
|
||||||
|
|
||||||
noinline
|
noinline
|
||||||
__attribute__((optimize("O0")))
|
NO_OPTIMIZE
|
||||||
int sukisu_handle_kpm(unsigned long arg3, unsigned long arg4, unsigned long arg5)
|
int sukisu_handle_kpm(unsigned long arg3, unsigned long arg4, unsigned long arg5)
|
||||||
{
|
{
|
||||||
if(arg3 == SUKISU_KPM_LOAD) {
|
if(arg3 == SUKISU_KPM_LOAD) {
|
||||||
|
|||||||
Reference in New Issue
Block a user