From: Richard Henderson Date: Tue, 29 Jul 2025 23:40:15 +0000 (-1000) Subject: linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a859022ceaba12444f1a8f5a5efc5e76c7d5dc13;p=thirdparty%2Fqemu.git linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h Move the workaround out of linux-user/elfload.c, so that we don't have to replicate it in many places. Place it immediately after the include of , which draws in the relevant symbols. Note that ARCH_DLINFO is not defined by the kernel header, and so there's no need to undef it either. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- diff --git a/hw/core/loader.c b/hw/core/loader.c index e7056ba4bd3..524af6f14a0 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -295,10 +295,6 @@ static void *load_at(int fd, off_t offset, size_t size) return ptr; } -#ifdef ELF_CLASS -#undef ELF_CLASS -#endif - #define ELF_CLASS ELFCLASS32 #include "elf.h" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 96fe51bc390..be3460b32f2 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -133,6 +133,14 @@ QEMU_EXTERN_C int daemon(int, int); #include #include +/* + * Avoid conflict with linux/arch/powerpc/include/uapi/asm/elf.h, included + * from , but we might as well do this unconditionally. + */ +#undef ELF_CLASS +#undef ELF_DATA +#undef ELF_ARCH + #ifdef CONFIG_IOVEC #include #endif diff --git a/linux-user/elfload.c b/linux-user/elfload.c index ea214105ff8..4ca8c39dc26 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -35,16 +35,6 @@ #include "target/arm/cpu-features.h" #endif -#ifdef _ARCH_PPC64 -#undef ARCH_DLINFO -#undef ELF_PLATFORM -#undef ELF_HWCAP -#undef ELF_HWCAP2 -#undef ELF_CLASS -#undef ELF_DATA -#undef ELF_ARCH -#endif - #ifndef TARGET_ARCH_HAS_SIGTRAMP_PAGE #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0 #endif