From 1fa0dc9a49d024c4a421116e326ee561f0aaeebe Mon Sep 17 00:00:00 2001 From: binarycraft007 Date: Thu, 8 Feb 2024 22:41:55 +0800 Subject: [PATCH] kernel: fix build errors for clang --- kernel/include/cache.h | 4 ++-- kernel/linux/include/linux/rcupdate.h | 9 ++++++++- kernel/patch/module/module.c | 5 +++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/kernel/include/cache.h b/kernel/include/cache.h index 1c0c4e24..48f35fc3 100644 --- a/kernel/include/cache.h +++ b/kernel/include/cache.h @@ -45,7 +45,7 @@ enum dma_data_direction static inline uint32_t current_el(void) { uint32_t el; - asm volatile("mrs %0, CurrentEL" : "=r"(el)); + asm volatile("mrs %w0, CurrentEL" : "=r"(el)); return el >> 2; } @@ -115,4 +115,4 @@ void __dma_flush_range(unsigned long start, unsigned long end); void __dma_map_area(unsigned long start, unsigned long size, enum dma_data_direction dir); void __dma_unmap_area(unsigned long start, unsigned long size, enum dma_data_direction dir); -#endif \ No newline at end of file +#endif diff --git a/kernel/linux/include/linux/rcupdate.h b/kernel/linux/include/linux/rcupdate.h index 43090ad7..f87c7f40 100644 --- a/kernel/linux/include/linux/rcupdate.h +++ b/kernel/linux/include/linux/rcupdate.h @@ -78,6 +78,7 @@ static inline void synchronize_rcu(void) static inline unsigned long get_completed_synchronize_rcu(void) { kfunc_call(get_completed_synchronize_rcu) + return 0; } static inline void get_completed_synchronize_rcu_full(struct rcu_gp_oldstate *rgosp) { @@ -136,18 +137,22 @@ static inline void rcu_irq_work_resched(void) static inline int rcu_read_lock_held(void) { kfunc_call(rcu_read_lock_held); + return 0; } static inline int rcu_read_lock_bh_held(void) { kfunc_call(rcu_read_lock_bh_held); + return 0; } static inline int rcu_read_lock_sched_held(void) { kfunc_call(rcu_read_lock_sched_held); + return 0; } static inline int rcu_read_lock_any_held(void) { kfunc_call(rcu_read_lock_any_held); + return 0; } static inline void rcu_init_nohz(void) @@ -157,10 +162,12 @@ static inline void rcu_init_nohz(void) static inline int rcu_nocb_cpu_offload(int cpu) { kfunc_call(rcu_nocb_cpu_offload, cpu); + return 0; } static inline int rcu_nocb_cpu_deoffload(int cpu) { kfunc_call(rcu_nocb_cpu_deoffload, cpu); + return 0; } static inline void rcu_nocb_flush_deferred_wakeup(void) { @@ -343,4 +350,4 @@ static inline bool rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t return false; } -#endif \ No newline at end of file +#endif diff --git a/kernel/patch/module/module.c b/kernel/patch/module/module.c index 7d30bfbc..ade08a9f 100644 --- a/kernel/patch/module/module.c +++ b/kernel/patch/module/module.c @@ -175,6 +175,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) int ret = 0; for (i = 1; i < symsec->sh_size / sizeof(Elf_Sym); i++) { + unsigned long addr; const char *name = info->strtab + sym[i].st_name; switch (sym[i].st_shndx) { case SHN_COMMON: @@ -186,7 +187,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) case SHN_ABS: break; case SHN_UNDEF: - unsigned long addr = symbol_lookup_name(name); + addr = symbol_lookup_name(name); // kernel symbol cause overflow in relocation // if (!addr) addr = kallsyms_lookup_name(name); if (!addr) { @@ -674,4 +675,4 @@ int module_init() INIT_LIST_HEAD(&modules.list); spin_lock_init(&module_lock); return 0; -} \ No newline at end of file +}