linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] sparc: pass endianness info to sparse
@ 2017-11-09  6:16 Luc Van Oostenryck
  2017-11-09  6:16 ` [PATCH v2 1/2] sparc: use a common CHECKFLAGS entry for common flags Luc Van Oostenryck
  2017-11-09  6:16 ` [PATCH v2 2/2] sparc: pass endianness info to sparse Luc Van Oostenryck
  0 siblings, 2 replies; 5+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:16 UTC (permalink / raw)
  To: David S . Miller
  Cc: Luc Van Oostenryck, Sam Ravnborg, sparclinux, linux-kernel

The goal of these two patches is to ass endianness and machine
size info to sparse so that sparse can emit correct diagnostics
even when the endianness or machine size doesn't correspond to
sparse's defaults.

Change since v1:
- move sparse options common to sparc32 & sparc64 at the 
  same place.

Luc Van Oostenryck (2):
  sparc: use a common CHECKFLAGS entry for common flags
  sparc: pass endianness info to sparse

 arch/sparc/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
To: David S. Miller <davem@davemloft.net>
CC: Sam Ravnborg <sam@ravnborg.org>
CC: sparclinux@vger.kernel.org
CC: linux-kernel@vger.kernel.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] sparc: use a common CHECKFLAGS entry for common flags
  2017-11-09  6:16 [PATCH v2 0/2] sparc: pass endianness info to sparse Luc Van Oostenryck
@ 2017-11-09  6:16 ` Luc Van Oostenryck
  2017-11-09  6:16 ` [PATCH v2 2/2] sparc: pass endianness info to sparse Luc Van Oostenryck
  1 sibling, 0 replies; 5+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:16 UTC (permalink / raw)
  To: David S . Miller
  Cc: Luc Van Oostenryck, Sam Ravnborg, sparclinux, linux-kernel

---
 arch/sparc/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 8496a074b..a42aa114e 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -14,12 +14,13 @@ else
         KBUILD_DEFCONFIG := sparc64_defconfig
 endif
 
+CHECKFLAGS     += -D__sparc__
+
 ifeq ($(CONFIG_SPARC32),y)
 #####
 # sparc32
 #
 
-CHECKFLAGS     += -D__sparc__
 LDFLAGS        := -m elf32_sparc
 export BITS    := 32
 UTS_MACHINE    := sparc
@@ -38,7 +39,7 @@ else
 # sparc64
 #
 
-CHECKFLAGS    += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
+CHECKFLAGS    += -D__sparc_v9__ -D__arch64__ -m64
 LDFLAGS       := -m elf64_sparc
 export BITS   := 64
 UTS_MACHINE   := sparc64
-- 
2.14.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] sparc: pass endianness info to sparse
  2017-11-09  6:16 [PATCH v2 0/2] sparc: pass endianness info to sparse Luc Van Oostenryck
  2017-11-09  6:16 ` [PATCH v2 1/2] sparc: use a common CHECKFLAGS entry for common flags Luc Van Oostenryck
@ 2017-11-09  6:16 ` Luc Van Oostenryck
  2017-11-09  8:34   ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09  6:16 UTC (permalink / raw)
  To: David S . Miller
  Cc: Luc Van Oostenryck, Sam Ravnborg, sparclinux, linux-kernel

sparc is big-endian only but sparse assumes the same endianness
as the building machine.
This is problematic for code which expect __BYTE_ORDER__ being
correctly predefined by the compiler which sparse can then
pre-process differently from what gcc would, depending on the
building machine endianness.

Fix this by letting sparse know about the architecture endianness.

To: David S. Miller <davem@davemloft.net>
CC: sparclinux@vger.kernel.org
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 arch/sparc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index a42aa114e..08d477faf 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -14,7 +14,7 @@ else
         KBUILD_DEFCONFIG := sparc64_defconfig
 endif
 
-CHECKFLAGS     += -D__sparc__
+CHECKFLAGS     += -D__sparc__ -mbig-endian
 
 ifeq ($(CONFIG_SPARC32),y)
 #####
-- 
2.14.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] sparc: pass endianness info to sparse
  2017-11-09  6:16 ` [PATCH v2 2/2] sparc: pass endianness info to sparse Luc Van Oostenryck
@ 2017-11-09  8:34   ` Christoph Hellwig
  2017-11-09 13:13     ` Luc Van Oostenryck
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2017-11-09  8:34 UTC (permalink / raw)
  To: Luc Van Oostenryck
  Cc: David S . Miller, Sam Ravnborg, sparclinux, linux-kernel

On Thu, Nov 09, 2017 at 07:16:52AM +0100, Luc Van Oostenryck wrote:
> sparc is big-endian only but sparse assumes the same endianness
> as the building machine.
> This is problematic for code which expect __BYTE_ORDER__ being
> correctly predefined by the compiler which sparse can then
> pre-process differently from what gcc would, depending on the
> building machine endianness.
> 
> Fix this by letting sparse know about the architecture endianness.

You're posted patches for this for about half a dozen architectures
now, but we also now have generic Kconfig symbols for the byte order.

I'd much rather see this done in generic code than hacking it up
everywhere.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] sparc: pass endianness info to sparse
  2017-11-09  8:34   ` Christoph Hellwig
@ 2017-11-09 13:13     ` Luc Van Oostenryck
  0 siblings, 0 replies; 5+ messages in thread
From: Luc Van Oostenryck @ 2017-11-09 13:13 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: David S . Miller, Sam Ravnborg, sparclinux, LKML, Heiko Carstens,
	Arnd Bergmann, Martin Schwidefsky, Babu Moger

On Thu, Nov 9, 2017 at 9:34 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Thu, Nov 09, 2017 at 07:16:52AM +0100, Luc Van Oostenryck wrote:
>> sparc is big-endian only but sparse assumes the same endianness
>> as the building machine.
>> This is problematic for code which expect __BYTE_ORDER__ being
>> correctly predefined by the compiler which sparse can then
>> pre-process differently from what gcc would, depending on the
>> building machine endianness.
>>
>> Fix this by letting sparse know about the architecture endianness.
>
> You're posted patches for this for about half a dozen architectures
> now, but we also now have generic Kconfig symbols for the byte order.
>
> I'd much rather see this done in generic code than hacking it up
> everywhere.

OK, when I wrote these patch (in June, IIRC) there wasn't yet the
generic Kconfig symbol. I'll see what can now be generic and what
need to stay specific (for example, ARM need __ARME{L,B}__,
ARM64 & MIPS are in the same situation as are a few others archs).

-- Luc Van Oostenryck

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-09 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09  6:16 [PATCH v2 0/2] sparc: pass endianness info to sparse Luc Van Oostenryck
2017-11-09  6:16 ` [PATCH v2 1/2] sparc: use a common CHECKFLAGS entry for common flags Luc Van Oostenryck
2017-11-09  6:16 ` [PATCH v2 2/2] sparc: pass endianness info to sparse Luc Van Oostenryck
2017-11-09  8:34   ` Christoph Hellwig
2017-11-09 13:13     ` 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).