On 08/28/2014 06:13 PM, Mauricio Faria de Oliveira wrote:
I'll send more details/demonstration/debugging on another e-mail.

The failure:

make[6]: Entering directory '/root/linux-tools/linux-tools-3.16~rc7/debian/build/scripts/mod' gcc -include real-lsb-32/types.h -I/root/linux-tools/linux-tools-3.16~rc7/include -S -o real-lsb-32/devicetable-offsets.s /root/linux-tools/linux-tools-3.16~rc7/scripts/mod/devicetable-offsets.c
        In file included from ./real-lsb-32/types.h:1:0,
                         from <command-line>:0:
/root/linux-tools/linux-tools-3.16~rc7/include/linux/types.h:149:9: error: unknown type name 'u32'
         typedef u32 dma_addr_t;
                 ^
/root/linux-tools/linux-tools-3.16~rc7/include/linux/types.h:165:9: error: unknown type name 'u32'
         typedef u32 phys_addr_t;
                 ^
Makefile.real:16: recipe for target 'real-lsb-32/devicetable-offsets.s' failed
        make[6]: *** [real-lsb-32/devicetable-offsets.s] Error 1


For debugging purposes, we'll use the preprocessor output (-E) with macro definitions (-dD); i.e.,

-gcc -include real-lsb-32/types.h -I/root/linux-tools/linux-tools-3.16~rc7/include -S -o real-lsb-32/devicetable-offsets.s /root/linux-tools/linux-tools-3.16~rc7/scripts/mod/devicetable-offsets.c +gcc -include real-lsb-32/types.h -I/root/linux-tools/linux-tools-3.16~rc7/include -E -dD
/root/linux-tools/linux-tools-3.16~rc7/scripts/mod/devicetable-offsets.c


Now let's go check/test with the definion of __SANE_USERSPACE_TYPES__.


- step 0) Reproduce the error:

        (the environment used ahead)
        $ cd /root/linux-tools/linux-tools-3.16~rc7/debian/build/scripts/mod
$ GCC_ARGS='-include real-lsb-32/types.h -I/root/linux-tools/linux-tools-3.16~rc7/include /root/linux-tools/linux-tools-3.16~rc7/scripts/mod/devicetable-offsets.c'

        
        $ gcc $GCC_ARGS -S -o /dev/null
        In file included from ./real-lsb-32/types.h:1:0,
                         from <command-line>:0:
/root/linux-tools/linux-tools-3.16~rc7/include/linux/types.h:149:9: error: unknown type name 'u32'
         typedef u32 dma_addr_t;
                 ^
/root/linux-tools/linux-tools-3.16~rc7/include/linux/types.h:165:9: error: unknown type name 'u32'
         typedef u32 phys_addr_t;
                 ^
        $ echo $?
        1

        Done.


- step 1) Verify fix by -D__SANE_USERSPACE_TYPES__

        $ gcc -D__SANE_USERSPACE_TYPES__ $GCC_ARGS -S -o /dev/null
        $ echo $?
        0


- step 2) Verify that __SANE_USERSPACE_TYPES__ is defined, as in that patch:

        $ grep SANE_USERSPACE_TYPES ../../../../tools/include/linux/types.h
        #define __SANE_USERSPACE_TYPES__        /* For PPC64, to get LL64 types 
*/

        Ok, it's there.


- step 3) But why that fails?

        Because but that file/definition is not included by the file failing:

        $ gcc $GCC_ARGS -E -dD | grep SANE_USERSPACE_TYPES
        $
        
        So, 'int-l64.h' is taken...
        
        $ gcc $GCC_ARGS -E -dD | grep 'int-l.*64.h'
        # 1 "/usr/include/asm-generic/int-l64.h" 1 3 4
        # 9 "/usr/include/asm-generic/int-l64.h" 3 4
        # 12 "/usr/include/asm-generic/int-l64.h" 2 3 4

        ... and no 'u32' is defined:

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


- step 4) How does -D__SANE_USERSPACE_TYPES__ fix that?
        
        It makes 'int-ll64.h' to be taken...
        
        $ gcc -D__SANE_USERSPACE_TYPES__ $GCC_ARGS -E -dD | grep 'int-l.*64.h'
# 1 "/root/linux-tools/linux-tools-3.16~rc7/include/asm-generic/int-ll64.h" 1 3 4 # 1 "/root/linux-tools/linux-tools-3.16~rc7/include/uapi/asm-generic/int-ll64.h" 1 3 4 # 9 "/root/linux-tools/linux-tools-3.16~rc7/include/uapi/asm-generic/int-ll64.h" 3 4 # 12 "/root/linux-tools/linux-tools-3.16~rc7/include/uapi/asm-generic/int-ll64.h" 2 3 4 # 11 "/root/linux-tools/linux-tools-3.16~rc7/include/asm-generic/int-ll64.h" 2 3 4

        ... and thus 'u32' is defined:

$ gcc -D__SANE_USERSPACE_TYPES__ $GCC_ARGS -E -dD | grep u32 | grep -v __u32
        typedef unsigned int u32;
        typedef u32 dma_addr_t;
        typedef u32 phys_addr_t;
        
        And gcc is happy.

--
Mauricio Faria de Oliveira
IBM Linux Technology Center


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: https://lists.debian.org/[email protected]

Reply via email to