* [PATCH] arm: pass endianness info to sparse
@ 2017-06-24 15:38 Luc Van Oostenryck
2017-06-26 8:53 ` Russell King - ARM Linux
0 siblings, 1 reply; 4+ messages in thread
From: Luc Van Oostenryck @ 2017-06-24 15:38 UTC (permalink / raw)
To: linux-arm-kernel
ARM depends on the macros '__ARMEL__' & '__ARMEB__' being defined
or not to correctly select or define endian-specific macros,
structures or pieces of code.
These macros are predefined by the compiler but sparse knows
nothing about them and thus may pre-process files differently
from what gcc would.
Fix this by passing '-D__ARMEL__' or '-D__ARMEB__' to sparse,
depending of the endianness of the kernel, like defined by GCC.
Note: In most case it won't change anything since most ARMs use
little-endian (but an allyesconfig would use big-endian!).
CC: Russell King <linux@armlinux.org.uk>
CC: linux-arm-kernel at lists.infradead.org
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
arch/arm/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 65f4e2a4e..0fca46d7f 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -44,10 +44,12 @@ endif
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
KBUILD_CPPFLAGS += -mbig-endian
+CHECKFLAGS += -D__ARMEB__
AS += -EB
LD += -EB
else
KBUILD_CPPFLAGS += -mlittle-endian
+CHECKFLAGS += -D__ARMEL__
AS += -EL
LD += -EL
endif
--
2.13.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] arm: pass endianness info to sparse
2017-06-24 15:38 [PATCH] arm: pass endianness info to sparse Luc Van Oostenryck
@ 2017-06-26 8:53 ` Russell King - ARM Linux
2017-06-27 7:54 ` Luc Van Oostenryck
0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2017-06-26 8:53 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Jun 24, 2017 at 05:38:42PM +0200, Luc Van Oostenryck wrote:
> ARM depends on the macros '__ARMEL__' & '__ARMEB__' being defined
> or not to correctly select or define endian-specific macros,
> structures or pieces of code.
>
> These macros are predefined by the compiler but sparse knows
> nothing about them and thus may pre-process files differently
> from what gcc would.
>
> Fix this by passing '-D__ARMEL__' or '-D__ARMEB__' to sparse,
> depending of the endianness of the kernel, like defined by GCC.
>
> Note: In most case it won't change anything since most ARMs use
> little-endian (but an allyesconfig would use big-endian!).
I wonder if that's a good thing - as this changes the endian conversion
macros and ifdefs around bitfield declarations, it means that we're not
testing the "popular" paths with an allyesconfig sparse - but then again,
I think allyesconfig with sparse is a very bad idea, it needs to be
targetted to the area being worked in.
> CC: Russell King <linux@armlinux.org.uk>
> CC: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
> arch/arm/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 65f4e2a4e..0fca46d7f 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -44,10 +44,12 @@ endif
>
> ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
> KBUILD_CPPFLAGS += -mbig-endian
> +CHECKFLAGS += -D__ARMEB__
> AS += -EB
> LD += -EB
> else
> KBUILD_CPPFLAGS += -mlittle-endian
> +CHECKFLAGS += -D__ARMEL__
> AS += -EL
> LD += -EL
> endif
> --
> 2.13.0
>
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm: pass endianness info to sparse
2017-06-26 8:53 ` Russell King - ARM Linux
@ 2017-06-27 7:54 ` Luc Van Oostenryck
0 siblings, 0 replies; 4+ messages in thread
From: Luc Van Oostenryck @ 2017-06-27 7:54 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jun 26, 2017 at 09:53:11AM +0100, Russell King - ARM Linux wrote:
> On Sat, Jun 24, 2017 at 05:38:42PM +0200, Luc Van Oostenryck wrote:
> > ARM depends on the macros '__ARMEL__' & '__ARMEB__' being defined
> > or not to correctly select or define endian-specific macros,
> > structures or pieces of code.
> >
> > These macros are predefined by the compiler but sparse knows
> > nothing about them and thus may pre-process files differently
> > from what gcc would.
> >
> > Fix this by passing '-D__ARMEL__' or '-D__ARMEB__' to sparse,
> > depending of the endianness of the kernel, like defined by GCC.
> >
> > Note: In most case it won't change anything since most ARMs use
> > little-endian (but an allyesconfig would use big-endian!).
>
> I wonder if that's a good thing - as this changes the endian conversion
> macros and ifdefs around bitfield declarations, it means that we're not
> testing the "popular" paths with an allyesconfig sparse - but then again,
> I think allyesconfig with sparse is a very bad idea, it needs to be
> targetted to the area being worked in.
The problem is that on any CONFIG_CPU_BIG_ENDIAN config, sparse
will process the wrong code after a '#if[n]def __ARMEB__'. Same,
of course with a little-endian config and '#if[n]def __ARMEL__'.
Since only two files test after __ARMEL__ :
- crypto/sha1-armv4-large.S
- crypto/sha512-core.S
most of the code are checked correctly for a little-endian config.
The same is not true for a big endian config since all the others
tests are made against __ARMEB__.
In short no big-endian config have never been sparse-checked for
endiannness problems on ARM. Worse, they are wrongly checked.
-- Luc Van Oostenryck
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] arm: pass endianness info to sparse
@ 2017-10-31 17:21 Luc Van Oostenryck
0 siblings, 0 replies; 4+ messages in thread
From: Luc Van Oostenryck @ 2017-10-31 17:21 UTC (permalink / raw)
To: linux-arm-kernel
ARM depends on the macros '__ARMEL__' & '__ARMEB__' being defined
or not to correctly select or define endian-specific macros,
structures or pieces of code.
These macros are predefined by the compiler but sparse knows
nothing about them and thus may pre-process files differently
from what gcc would.
Fix this by passing '-D__ARMEL__' or '-D__ARMEB__' to sparse,
depending on the endianness of the kernel, like defined by GCC.
Note: In most case it won't change anything since most ARMs use
little-endian (but an allyesconfig would use big-endian!).
To: Russell King <linux@armlinux.org.uk>
CC: linux-arm-kernel at lists.infradead.org
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
arch/arm/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 817e5cfef..36ae44545 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -44,10 +44,12 @@ endif
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
KBUILD_CPPFLAGS += -mbig-endian
+CHECKFLAGS += -D__ARMEB__
AS += -EB
LD += -EB
else
KBUILD_CPPFLAGS += -mlittle-endian
+CHECKFLAGS += -D__ARMEL__
AS += -EL
LD += -EL
endif
--
2.14.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-31 17:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-24 15:38 [PATCH] arm: pass endianness info to sparse Luc Van Oostenryck
2017-06-26 8:53 ` Russell King - ARM Linux
2017-06-27 7:54 ` Luc Van Oostenryck
-- strict thread matches above, loose matches on Subject: below --
2017-10-31 17:21 Luc Van Oostenryck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).