KernelPatch icon indicating copy to clipboard operation
KernelPatch copied to clipboard

kernel: fix build errors for clang

Open binarycraft007 opened this issue 1 year ago • 5 comments

This PR fixes some compile error for clang when I was trying to cross compile kpimg.

KernelPatch/kernel/include/cache.h:48:45: error: value size does not match register size specified by the constraint and modifier
    asm volatile("mrs %0, CurrentEL" : "=r"(el));
                                            ^
KernelPatch/kernel/patch/module/module.c:13:10: note: in file included from KernelPatch/kernel/patch/module/module.c:13:
#include <cache.h>
         ^
KernelPatch/kernel/include/cache.h:48:23: note: use constraint modifier "w"
    asm volatile("mrs %0, CurrentEL" : "=r"(el));
                      ^~~
KernelPatch/kernel/linux/include/linux/rcupdate.h:81:1: error: non-void function does not return a value in all control paths
}
^
KernelPatch/kernel/patch/module/module.c:23:10: note: in file included from KernelPatch/kernel/patch/module/module.c:23:
#include <linux/rcupdate.h>
         ^
KernelPatch/kernel/linux/include/linux/rcupdate.h:139:1: error: non-void function does not return a value in all control paths
}
^
KernelPatch/kernel/patch/module/module.c:23:10: note: in file included from KernelPatch/kernel/patch/module/module.c:23:
#include <linux/rcupdate.h>
         ^
KernelPatch/kernel/linux/include/linux/rcupdate.h:143:1: error: non-void function does not return a value in all control paths
}
^
KernelPatch/kernel/patch/module/module.c:23:10: note: in file included from KernelPatch/kernel/patch/module/module.c:23:
#include <linux/rcupdate.h>
         ^
KernelPatch/kernel/linux/include/linux/rcupdate.h:147:1: error: non-void function does not return a value in all control paths
}
^
KernelPatch/kernel/patch/module/module.c:23:10: note: in file included from KernelPatch/kernel/patch/module/module.c:23:
#include <linux/rcupdate.h>
         ^
KernelPatch/kernel/linux/include/linux/rcupdate.h:151:1: error: non-void function does not return a value in all control paths
}
^
KernelPatch/kernel/patch/module/module.c:23:10: note: in file included from KernelPatch/kernel/patch/module/module.c:23:
#include <linux/rcupdate.h>
         ^
KernelPatch/kernel/linux/include/linux/rcupdate.h:160:1: error: non-void function does not return a value in all control paths
}
^
KernelPatch/kernel/patch/module/module.c:23:10: note: in file included from KernelPatch/kernel/patch/module/module.c:23:
#include <linux/rcupdate.h>
         ^
KernelPatch/kernel/linux/include/linux/rcupdate.h:164:1: error: non-void function does not return a value in all control paths
}
^
KernelPatch/kernel/patch/module/module.c:23:10: note: in file included from KernelPatch/kernel/patch/module/module.c:23:
#include <linux/rcupdate.h>
         ^
KernelPatch/kernel/patch/module/module.c:189:13: error: expected expression
            unsigned long addr = symbol_lookup_name(name);
            ^
KernelPatch/kernel/patch/module/module.c:192:18: error: use of undeclared identifier 'addr'
            if (!addr) {
                 ^
KernelPatch/kernel/patch/module/module.c:197:31: error: use of undeclared identifier 'addr'
            sym[i].st_value = addr;
                              ^

binarycraft007 avatar Feb 08 '24 14:02 binarycraft007

have you tested the kpimg

bmax121 avatar Feb 15 '24 00:02 bmax121

have you tested the kpimg

patch was successful, os is enable to boot, but the latest apatch version is too old maybe, it doesn't detect kpimg with superkey inputed.

binarycraft007 avatar Feb 26 '24 15:02 binarycraft007

have you tested the kpimg

hi, just installed the latest apk from apatch github workflow, the kpimg works

binarycraft007 avatar Feb 27 '24 15:02 binarycraft007

good, but your modification is no longer applicable to gcc

bmax121 avatar Feb 29 '24 01:02 bmax121

Can kpm be successfully loaded after using clang to compile kpimg? I used clang and found that module loading failed.

sekaiacg avatar Mar 02 '24 14:03 sekaiacg