From 58267765c82531a4408a1e792c47b4d4927fce7c Mon Sep 17 00:00:00 2001 From: George Guo Date: Fri, 8 Nov 2024 15:03:26 +0800 Subject: [PATCH] kpatch/LoongArch: fix build error on non-LoongArch architectures Added conditional compilation to prevent 'R_LARCH_64' and 'EM_LOONGARCH' from being referenced on x86 and other non-LoongArch architectures. This ensures the code works across different architectures without errors. Signed-off-by: George Guo --- kpatch-build/kpatch-elf.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kpatch-build/kpatch-elf.h b/kpatch-build/kpatch-elf.h index f881ead4..f998aef0 100644 --- a/kpatch-build/kpatch-elf.h +++ b/kpatch-build/kpatch-elf.h @@ -31,6 +31,11 @@ #define SHF_RELA_LIVEPATCH 0x00100000 #define SHN_LIVEPATCH 0xff20 +#ifndef __loongarch__ +#define EM_LOONGARCH 258 /* LoongArch */ +#define R_LARCH_64 2 +#endif + /******************* * Data structures * ****************/