Patchwork [4/5] sparc: use asm-generic version of types.h

login
register
mail settings
Submitter Sam Ravnborg
Date March 30, 2013, 9:44 p.m.
Message ID <1364679866-29982-4-git-send-email-sam@ravnborg.org>
Download mbox | patch
Permalink /patch/232578/
State Superseded
Delegated to: David Miller
Headers show

Comments

Sam Ravnborg - March 30, 2013, 9:44 p.m.
This fixes build errors in samples/

We failed to include the header file that define __u16 because __sparc__
was not defined.
This check is not required - and removing this made us
compatible with the generic types.h version. So use that.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 arch/sparc/include/asm/Kbuild       |    1 +
 arch/sparc/include/uapi/asm/Kbuild  |    1 -
 arch/sparc/include/uapi/asm/types.h |   17 -----------------
 3 files changed, 1 insertions(+), 18 deletions(-)
 delete mode 100644 arch/sparc/include/uapi/asm/types.h
David Miller - March 30, 2013, 10:02 p.m.
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 30 Mar 2013 22:44:25 +0100

> We failed to include the header file that define __u16 because __sparc__
> was not defined.

Is this another problem with your cross compiler?

__sparc__ should always be defined, it's a CPP pre-define.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg - March 30, 2013, 10:07 p.m.
On Sat, Mar 30, 2013 at 06:02:47PM -0400, David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Sat, 30 Mar 2013 22:44:25 +0100
> 
> > We failed to include the header file that define __u16 because __sparc__
> > was not defined.
> 
> Is this another problem with your cross compiler?
> 
> __sparc__ should always be defined, it's a CPP pre-define.

Maybe..

But Fengguang Wu see the same issue in his 0-day
testing.
But maybe we have both gcc issues.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - March 30, 2013, 11:17 p.m.
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 30 Mar 2013 23:07:33 +0100

> On Sat, Mar 30, 2013 at 06:02:47PM -0400, David Miller wrote:
>> From: Sam Ravnborg <sam@ravnborg.org>
>> Date: Sat, 30 Mar 2013 22:44:25 +0100
>> 
>> > We failed to include the header file that define __u16 because __sparc__
>> > was not defined.
>> 
>> Is this another problem with your cross compiler?
>> 
>> __sparc__ should always be defined, it's a CPP pre-define.
> 
> Maybe..
> 
> But Fengguang Wu see the same issue in his 0-day
> testing.
> But maybe we have both gcc issues.

I'm not fundamentally against these changes, if there would be
a good reason for them.

But it seems to me that these cross compilers are terminally broken,
you cannot seriously even expect them to be able to compiler userland
successfully at all because __linux__ and __sparc__ must be CPP
predefined for userspace to compiler properly.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sam Ravnborg - March 31, 2013, 7:48 a.m.
On Sat, Mar 30, 2013 at 07:17:37PM -0400, David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Sat, 30 Mar 2013 23:07:33 +0100
> 
> > On Sat, Mar 30, 2013 at 06:02:47PM -0400, David Miller wrote:
> >> From: Sam Ravnborg <sam@ravnborg.org>
> >> Date: Sat, 30 Mar 2013 22:44:25 +0100
> >> 
> >> > We failed to include the header file that define __u16 because __sparc__
> >> > was not defined.
> >> 
> >> Is this another problem with your cross compiler?
> >> 
> >> __sparc__ should always be defined, it's a CPP pre-define.
> > 
> > Maybe..
> > 
> > But Fengguang Wu see the same issue in his 0-day
> > testing.
> > But maybe we have both gcc issues.
> 
> I'm not fundamentally against these changes, if there would be
> a good reason for them.
> 
> But it seems to me that these cross compilers are terminally broken,
> you cannot seriously even expect them to be able to compiler userland
> successfully at all because __linux__ and __sparc__ must be CPP
> predefined for userspace to compiler properly.

I confused myself yesterday concerning this patch/fix...

The build error in samples/hiddraw happens because the said code
is built using the host gcc - and not my cross-compiled gcc.
This is the intention - when readign the Makefile.

So this is not a broken cross gcc.

I think they have mixed it up and what they really wanted was to build
a regular user binary for the selected architecture.
I will followup on this in another thread.


In sparc headers we use the following pattern:

    #if defined(__sparc__) && defined(__arch64__)

    sparc64 specific stuff

    #else

    sparc32 specific stuff

    #endif

In types.h this pattern was not followed and here
we only checked for __sparc__ for no good reason.
It was a left-over from long time ago.

I checked other architectures - and most of them
do not have any such checks. And all the recently
merged versions uses the asm-generic version

So independent on the build error reported by Fengguang Wu
and independent on my broken cross gcc this patch is fine.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - March 31, 2013, 4:41 p.m.
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sun, 31 Mar 2013 09:48:46 +0200

> In sparc headers we use the following pattern:
 ...
> In types.h this pattern was not followed and here
> we only checked for __sparc__ for no good reason.
> It was a left-over from long time ago.
> 
> I checked other architectures - and most of them
> do not have any such checks. And all the recently
> merged versions uses the asm-generic version
> 
> So independent on the build error reported by Fengguang Wu
> and independent on my broken cross gcc this patch is fine.

Please resubmit this patch with the more accurate description
you've provided above.  Thanks!
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index f73884b..ff18e3c 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -13,4 +13,5 @@  generic-y += local.h
 generic-y += module.h
 generic-y += serial.h
 generic-y += trace_clock.h
+generic-y += types.h
 generic-y += word-at-a-time.h
diff --git a/arch/sparc/include/uapi/asm/Kbuild b/arch/sparc/include/uapi/asm/Kbuild
index ce175af..b5843ee 100644
--- a/arch/sparc/include/uapi/asm/Kbuild
+++ b/arch/sparc/include/uapi/asm/Kbuild
@@ -44,7 +44,6 @@  header-y += swab.h
 header-y += termbits.h
 header-y += termios.h
 header-y += traps.h
-header-y += types.h
 header-y += uctx.h
 header-y += unistd.h
 header-y += utrap.h
diff --git a/arch/sparc/include/uapi/asm/types.h b/arch/sparc/include/uapi/asm/types.h
deleted file mode 100644
index 383d156..0000000
--- a/arch/sparc/include/uapi/asm/types.h
+++ /dev/null
@@ -1,17 +0,0 @@ 
-#ifndef _SPARC_TYPES_H
-#define _SPARC_TYPES_H
-/*
- * This file is never included by application software unless
- * explicitly requested (e.g., via linux/types.h) in which case the
- * application is Linux specific so (user-) name space pollution is
- * not a major issue.  However, for interoperability, libraries still
- * need to be careful to avoid a name clashes.
- */
-
-#if defined(__sparc__)
-
-#include <asm-generic/int-ll64.h>
-
-#endif /* defined(__sparc__) */
-
-#endif /* defined(_SPARC_TYPES_H) */