[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210514084649.GI10366@gate.crashing.org>
Date: Fri, 14 May 2021 03:46:49 -0500
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>,
Alexey Kardashevskiy <aik@...abs.ru>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Michal Marek <michal.lkml@...kovi.net>,
Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [PATCH kernel v3] powerpc/makefile: Do not redefine $(CPP) for preprocessor
Hi!
On Fri, May 14, 2021 at 11:42:32AM +0900, Masahiro Yamada wrote:
> In my best guess, the reason why powerpc adding the endian flag to CPP
> is this line in arch/powerpc/kernel/vdso64/vdso64.lds.S
>
> #ifdef __LITTLE_ENDIAN__
> OUTPUT_FORMAT("elf64-powerpcle", "elf64-powerpcle", "elf64-powerpcle")
> #else
> OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc")
> #endif
Which is equivalent to
#ifdef __LITTLE_ENDIAN__
OUTPUT_FORMAT("elf64-powerpcle")
#else
OUTPUT_FORMAT("elf64-powerpc")
#endif
so please change that at the same time if you touch this :-)
> __LITTLE_ENDIAN__ is defined by powerpc gcc and clang.
This predefined macro is required by the newer ABIs, but all older
compilers have it as well. _LITTLE_ENDIAN is not supported on all
platforms (but it is if your compiler targets Linux, which you cannot
necessarily rely on). These macros are PowerPC-specific.
For GCC, for all targets, you can say
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
You do not need any of the other *ORDER__ macros in most cases.
See "info cpp" for the sordid details.
> [2] powerpc-linux-gnu-gcc + -mlittle-endian -> __LITTLE_ENDIAN__ is defined
You can just write -mbig and -mlittle btw. Those aren't available on
all targets, but neither are the long-winded -m{big,little}-endian
option names. Pet peeve, I know :-)
HtH,
Segher
Powered by blists - more mailing lists