All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc: pass endianness info to sparse
@ 2017-10-31 17:22 Luc Van Oostenryck
  2017-11-02  5:41 ` Sam Ravnborg
  2017-11-02  6:14 ` Luc Van Oostenryck
  0 siblings, 2 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-10-31 17:22 UTC (permalink / raw)
  To: sparclinux

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, 2 insertions(+)

diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index 8496a074b..ef1598f5a 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -55,6 +55,8 @@ endif
 
 endif
 
+CHECKFLAGS     += -mbig-endian
+
 head-y                 := arch/sparc/kernel/head_$(BITS).o
 
 # See arch/sparc/Kbuild for the core part of the kernel
-- 
2.14.0


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

* Re: [PATCH] sparc: pass endianness info to sparse
  2017-10-31 17:22 [PATCH] sparc: pass endianness info to sparse Luc Van Oostenryck
@ 2017-11-02  5:41 ` Sam Ravnborg
  2017-11-02  6:14 ` Luc Van Oostenryck
  1 sibling, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2017-11-02  5:41 UTC (permalink / raw)
  To: sparclinux

Hi Luc.

On Tue, Oct 31, 2017 at 06:22:10PM +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.
> 
> 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, 2 insertions(+)
> 
> diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
> index 8496a074b..ef1598f5a 100644
> --- a/arch/sparc/Makefile
> +++ b/arch/sparc/Makefile
> @@ -55,6 +55,8 @@ endif
>  
>  endif
>  
> +CHECKFLAGS     += -mbig-endian
> +

You have added a new assignment to CHECKFLAGS because this
options is the same for sparc32 and sparc64, which is fine.

But could you then in the same patch
also move the assingmnet to -D__sparc__ this place, as this is also
a common option for sparc32 and sparc64.
As it is after your patch we have common options duplicated (__sparc__)
and in their own assignment (-mbig-endian).
This is inconsistent and may confuse the next reader.

	Sam

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

* Re: [PATCH] sparc: pass endianness info to sparse
  2017-10-31 17:22 [PATCH] sparc: pass endianness info to sparse Luc Van Oostenryck
  2017-11-02  5:41 ` Sam Ravnborg
@ 2017-11-02  6:14 ` Luc Van Oostenryck
  1 sibling, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2017-11-02  6:14 UTC (permalink / raw)
  To: sparclinux

On Thu, Nov 2, 2017 at 6:41 AM, Sam Ravnborg <sam@ravnborg.org> wrote:
> Hi Luc.

Hi,

>> +CHECKFLAGS     += -mbig-endian
>> +
>
> You have added a new assignment to CHECKFLAGS because this
> options is the same for sparc32 and sparc64, which is fine.
>
> But could you then in the same patch
> also move the assingmnet to -D__sparc__ this place, as this is also
> a common option for sparc32 and sparc64.
> As it is after your patch we have common options duplicated (__sparc__)
> and in their own assignment (-mbig-endian).
> This is inconsistent and may confuse the next reader.

Yes, I agree but it seems a bit strange to me to do that in the same patch.
I suppose it doesn't matter much for such small patch, anyway.

-- Luc

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

end of thread, other threads:[~2017-11-02  6:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-31 17:22 [PATCH] sparc: pass endianness info to sparse Luc Van Oostenryck
2017-11-02  5:41 ` Sam Ravnborg
2017-11-02  6:14 ` Luc Van Oostenryck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.