From: Nathan Chancellor <nathan@kernel.org>
To: Jens Reidel <adrian@mainlining.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] mips: Use generic endianness macros instead of MIPS-specific ones
Date: Sun, 9 Nov 2025 16:37:20 -0700 [thread overview]
Message-ID: <20251109233720.GB2977577@ax162> (raw)
In-Reply-To: <20251108-mips-bpf-fix-v1-1-0467c3ee2613@mainlining.org>
On Sat, Nov 08, 2025 at 11:05:55PM +0100, Jens Reidel wrote:
> Compiling bpf_skel for mips currently fails because clang --target=bpf
> is invoked and the source files include byteorder.h, which uses the
> MIPS-specific macros to determine the endianness, rather than the generic
> __LITTLE_ENDIAN__ / __BIG_ENDIAN__. Fix this by using the generic
> macros, which are also defined when targeting bpf. This is already done
> similarly for powerpc.
>
> Signed-off-by: Jens Reidel <adrian@mainlining.org>
As far as I can tell, this should be fine since clang defines these
macros in the generic case since [1] and I assume GCC does as well but
if there is a risk of this being a problem for userspace, these could be
added in addition to __MIPSEB__ / __MIPSEL__.
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
[1]: https://github.com/llvm/llvm-project/commit/2c942c64fb521357ed98c380823e79833a121d18
> ---
> arch/mips/include/uapi/asm/byteorder.h | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/include/uapi/asm/byteorder.h b/arch/mips/include/uapi/asm/byteorder.h
> index b4edc85f9c30c09aafbc189ec820e6e2f7cbe0d8..5e3c3baa24994a9f3637bf2b63ea7c3577cae541 100644
> --- a/arch/mips/include/uapi/asm/byteorder.h
> +++ b/arch/mips/include/uapi/asm/byteorder.h
> @@ -9,12 +9,10 @@
> #ifndef _ASM_BYTEORDER_H
> #define _ASM_BYTEORDER_H
>
> -#if defined(__MIPSEB__)
> -#include <linux/byteorder/big_endian.h>
> -#elif defined(__MIPSEL__)
> +#ifdef __LITTLE_ENDIAN__
> #include <linux/byteorder/little_endian.h>
> #else
> -# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
> +#include <linux/byteorder/big_endian.h>
> #endif
>
> #endif /* _ASM_BYTEORDER_H */
>
> ---
> base-commit: 9c0826a5d9aa4d52206dd89976858457a2a8a7ed
> change-id: 20251108-mips-bpf-fix-8d1f14bc4903
>
> Best regards,
> --
> Jens Reidel <adrian@mainlining.org>
next prev parent reply other threads:[~2025-11-09 23:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-08 22:05 [PATCH] mips: Use generic endianness macros instead of MIPS-specific ones Jens Reidel
2025-11-09 23:37 ` Nathan Chancellor [this message]
2025-11-10 1:34 ` Maciej W. Rozycki
2025-11-10 21:08 ` Nathan Chancellor
2025-11-10 21:32 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251109233720.GB2977577@ax162 \
--to=nathan@kernel.org \
--cc=adrian@mainlining.org \
--cc=bpf@vger.kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox