Package: linux-tools
Tags: patch

Hi Ben,

On 08/28/2014 03:00 PM, Ben Hutchings wrote:
I thought this would do it:

commit d944c4eebcf4c0d5e5d9728fec110cbf0047ad7f

Ok, I just checked and it really didn't do it on this case. :-/
AFAICT, this bug really needs -D__SANE_USERSPACE_TYPES__.

Details below.

I am attaching a patch w/ the previous fix, for your convenience.
May you please consider it for commit, if you agree it's a proper fix?


Details:
--------

That commit [1] does '#define __SANE_USERSPACE_TYPES__' on a types.h
that gets no '#include' by the files related to this bug.

The definition was added in 'tools/include/linux/types.h', but the only
'types.h' used are:

        $ gcc $GCC_ARGS -E -dD | fgrep types.h | cut -d'"' -f2 | sort -u
        ./real-lsb-32/types.h
        [...]/linux-tools-3.16~rc7/include/linux/types.h
        [...]/linux-tools-3.16~rc7/include/uapi/linux/types.h
        /usr/include/asm-generic/posix_types.h
        /usr/include/linux/posix_types.h
        /usr/include/powerpc64le-linux-gnu/asm/posix_types.h
        /usr/include/powerpc64le-linux-gnu/asm/types.h
        $

So, in order to get 'int-ll64.h' (not 'int-l64.h), and thus 'u32'
to be defined, that extra define is needed:

        $ gcc $GCC_ARGS -E -dD \
            | grep u32 | grep -v __u32
        typedef u32 dma_addr_t;
        typedef u32 phys_addr_t;
        $

        $ gcc $GCC_ARGS -E -dD \
            -D__SANE_USERSPACE_TYPES__ \
            | grep u32 | grep -v __u32
        typedef unsigned int u32;
        typedef u32 dma_addr_t;
        typedef u32 phys_addr_t;
        $

I'll send more details/demonstration/debugging on another e-mail.

Thanks!

[1] https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/tools/include/linux/types.h?id=d944c4eebcf4c0d5e5d9728fec110cbf0047ad7f

--
Mauricio Faria de Oliveira
IBM Linux Technology Center
diff -Nru linux-tools-3.16~rc7/debian/build/scripts/mod/Makefile.real 
linux-tools-3.16/debian/build/scripts/mod/Makefile.real
--- linux-tools-3.16~rc7/debian/build/scripts/mod/Makefile.real 2013-06-03 
10:19:37.000000000 -0300
+++ linux-tools-3.16/debian/build/scripts/mod/Makefile.real     2014-08-28 
17:42:57.000000000 -0300
@@ -6,6 +6,17 @@
 
 include $(top_srcdir)/debian/build/Makefile.inc
 
+DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+
+ifneq (,$(filter powerpc64 ppc64el,$(DEB_HOST_ARCH_CPU)))
+  # Fix "include/linux/types.h:148:1: error: unknown type name 'u32'". 
+  # (#747151 #754213)
+  # See linux commits:
+  #   "asm/types.h: Remove include/asm-generic/int-l64.h"
+  #   "powerpc: Add __SANE_USERSPACE_TYPES__ to asm/types.h for LL64"
+  CFLAGS += -D__SANE_USERSPACE_TYPES__
+endif
+
 modpost.real-$(TYPE): file2alias.real-$(TYPE).o modpost.real-$(TYPE).o 
sumversion.real-$(TYPE).o
        $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
 
diff -Nru linux-tools-3.16~rc7/debian/changelog 
linux-tools-3.16/debian/changelog
--- linux-tools-3.16~rc7/debian/changelog       2014-07-29 17:11:10.000000000 
-0300
+++ linux-tools-3.16/debian/changelog   2014-08-28 17:49:09.000000000 -0300
@@ -1,9 +1,11 @@
-linux-tools (3.16-1) UNRELEASED; urgency=medium
+linux-tools (3.16-1ppc64el1) UNRELEASED; urgency=medium
 
   * New upstream release
 
   [ Mauricio Faria de Oliveira ]
   * [ppc64el] Build linux-tools binary package (Closes: #754213)
+  * [ppc64el, ppc64] Build with -D__SANE_USERSPACE_TYPES__ on scripts/mod
+    (partially fixes #747151, for ppc64/ppc64el but not for alpha) 
 
  -- Ben Hutchings <[email protected]>  Sat, 23 Aug 2014 17:50:42 -0700
 

Reply via email to