git: cc79fd889da4 - stable/13 - linux(4): Use COMPAT_LINUX32 enstead of __ELF_WORD_SIZE.

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Thu, 09 Feb 2023 07:56:42 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=cc79fd889da4466a29aa77893a64d64a95ec60b3

commit cc79fd889da4466a29aa77893a64d64a95ec60b3
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-02-02 14:58:06 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-02-09 07:54:16 +0000

    linux(4): Use COMPAT_LINUX32 enstead of __ELF_WORD_SIZE.
    
    COMPAT_LINUX32 option is defined for case when building 32-bit Linuxulator
    for the 64-bit host. Usage of __ELF_WORD_SIZE is wrong here as it is equal to 32
    on i386 too.
    
    MFC after:              1 week
    
    (cherry picked from commit 6f8439db241c7409275d77f5376e8505967bef67)
---
 sys/compat/linux/linux_elf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/compat/linux/linux_elf.c b/sys/compat/linux/linux_elf.c
index e73dbdae888e..1da919f02a81 100644
--- a/sys/compat/linux/linux_elf.c
+++ b/sys/compat/linux/linux_elf.c
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include <machine/elf.h>
 
-#if __ELF_WORD_SIZE == 32
+#ifdef COMPAT_LINUX32
 #define linux_pt_regset linux_pt_regset32
 #define bsd_to_linux_regset bsd_to_linux_regset32
 #include <machine/../linux32/linux.h>
@@ -135,7 +135,7 @@ __linuxN(prepare_notes)(struct thread *td, struct note_info_list *list,
 }
 
 typedef struct linux_elf_prstatus linux_elf_prstatus_t;
-#if __ELF_WORD_SIZE == 32
+#ifdef COMPAT_LINUX32
 typedef struct prpsinfo32 linux_elf_prpsinfo_t;
 typedef struct fpreg32 linux_elf_prfpregset_t;
 #else
@@ -212,7 +212,7 @@ __linuxN(note_prstatus)(void *arg, struct sbuf *sb, size_t *sizep)
 {
 	struct thread *td;
 	linux_elf_prstatus_t *status;
-#if __ELF_WORD_SIZE == 32
+#ifdef COMPAT_LINUX32
 	struct reg32 pr_reg;
 #else
 	struct reg pr_reg;
@@ -229,7 +229,7 @@ __linuxN(note_prstatus)(void *arg, struct sbuf *sb, size_t *sizep)
 		status->pr_cursig = td->td_proc->p_sig;
 		status->pr_pid = td->td_tid;
 
-#if __ELF_WORD_SIZE == 32
+#ifdef COMPAT_LINUX32
 		fill_regs32(td, &pr_reg);
 #else
 		fill_regs(td, &pr_reg);
@@ -251,7 +251,7 @@ __linuxN(note_fpregset)(void *arg, struct sbuf *sb, size_t *sizep)
 	if (sb != NULL) {
 		KASSERT(*sizep == sizeof(*fpregset), ("invalid size"));
 		fpregset = malloc(sizeof(*fpregset), M_TEMP, M_ZERO | M_WAITOK);
-#if __ELF_WORD_SIZE == 32
+#ifdef COMPAT_LINUX32
 		fill_fpregs32(td, fpregset);
 #else
 		fill_fpregs(td, fpregset);