From: Michael Jeanson Date: Thu, 24 Nov 2022 19:25:33 +0000 (-0500) Subject: fix: kallsyms wrapper on ppc64el X-Git-Tag: v2.13.8~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=62b81e8835877ed8d654990266ceabbc4a2e82d3;p=lttng-modules.git fix: kallsyms wrapper on ppc64el The 'PPC64_ELF_ABI_v2' macro in 'asm/types.h' was removed in v5.19 and replaced by a config option 'CONFIG_PPC64_ELF_ABI_V2'. See upstream commit : commit 5b89492c03e5c0a2c259b97d7d4c1bb9b02860aa Author: Christophe Leroy Date: Mon May 9 07:36:08 2022 +0200 powerpc: Finalise cleanup around ABI use Now that we have CONFIG_PPC64_ELF_ABI_V1 and CONFIG_PPC64_ELF_ABI_V2, get rid of all indirect detection of ABI version. Link: https://lore.kernel.org/r/709d9d69523c14c8a9fba4486395dca0f2d675b1.1652074503.git.christophe.leroy@csgroup.eu Change-Id: Ibd00e35cab5516a6224bdfa5a6b540119b42dc55 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/include/wrapper/kallsyms.h b/include/wrapper/kallsyms.h index 6a3e27e9..0aac5a2d 100644 --- a/include/wrapper/kallsyms.h +++ b/include/wrapper/kallsyms.h @@ -16,11 +16,19 @@ #include #include +/* CONFIG_PPC64_ELF_ABI_V1/V2 were introduced in v5.19 */ +#if defined(CONFIG_PPC64_ELF_ABI_V2) || (defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN)) +#define LTTNG_CONFIG_PPC64_ELF_ABI_V2 +#endif +#if defined(CONFIG_PPC64_ELF_ABI_V1) || (defined(CONFIG_PPC64) && defined(CONFIG_CPU_BIG_ENDIAN)) +#define LTTNG_CONFIG_PPC64_ELF_ABI_V1 +#endif + /* * PowerPC ABIv1 needs KALLSYMS_ALL to get the function descriptor, * which is needed to perform the function call. */ -#if defined(CONFIG_PPC64) && (!defined(_CALL_ELF) || _CALL_ELF < 2) +#ifdef LTTNG_CONFIG_PPC64_ELF_ABI_V1 # ifndef CONFIG_KALLSYMS_ALL # error "LTTng-modules requires CONFIG_KALLSYMS_ALL on PowerPC ABIv1" # endif diff --git a/src/wrapper/kallsyms.c b/src/wrapper/kallsyms.c index 93017adc..061224de 100644 --- a/src/wrapper/kallsyms.c +++ b/src/wrapper/kallsyms.c @@ -39,7 +39,7 @@ unsigned long do_get_kallsyms(void) memset(&probe, 0, sizeof(probe)); probe.pre_handler = dummy_kprobe_handler; probe.symbol_name = "kallsyms_lookup_name"; -#ifdef PPC64_ELF_ABI_v2 +#ifdef LTTNG_CONFIG_PPC64_ELF_ABI_V2 /* * With powerpc64 ABIv2, we need the global entry point of * kallsyms_lookup_name to call it later, while kprobe_register would @@ -53,7 +53,7 @@ unsigned long do_get_kallsyms(void) ret = register_kprobe(&probe); if (ret) return 0; -#ifdef PPC64_ELF_ABI_v2 +#ifdef LTTNG_CONFIG_PPC64_ELF_ABI_V2 /* Substract 4 bytes to get what we originally want */ addr = (unsigned long)(((char *)probe.addr) - 4); #else