v4:
tried to fix v03 review findings
tried to fix all hack patches

v3:
https://lkml.org/lkml/2015/5/30/96
tried to fix all v2 review findings
tried to guess how to fix a few more issue
with a few hacks, 0 files fail and 760 files pass the compile test on 32bit x86

v2:
https://lkml.org/lkml/2015/2/16/521
added cross compiler support with CROSS_COMPILE,
detecting libc and GCC headers from compiler,
more header file fixes

v1:
https://lkml.org/lkml/2014/8/21/665

Users of kernel header files would be happier if they did not contain
kernel specific parts and would contain #include statements for all
other header files that they depend on, and in general would compile.

This patch set introduces a compile test for headers exported to userspace
and then fixes many of the userspace header compilation failures.

Changes are also available in headers_test_v04 branch at github:
https://github.com/mcfrisk/linux/tree/headers_test_v04

Here's how to run the userspace compile tests:

$ make headers_install && cd usr/include && \
  ../../scripts/headers_compile_test.sh

Additionally tested an allyesconfig compilation on i686, x86_64 and ARMEL.

For x86 and ARMEL all header file compile errors in userspace are
fixed with this series and Ingo Molnars x86/headers branch changes from
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git .

Remaining task is to fix all other archs.

If these changes are merged, it becomes possible to run abi-compliance-checker
tool https://lvc.github.io/abi-compliance-checker/ to detect API and ABI
breakages from the uapi headers.

Once all archs have completely compiling uapi headers, I would add this test
to 'make headers_check' build target to prevent regressions.

Mikko Rapeli (79):
  headers_install.sh: enhance error handling
  scripts/headers_compile_test.sh: compile test script for exported
    headers
  drm.h: use __kernel_size_t instead of size_t
  drm_mode.h: use __u32 and __u64 from linux/types.h
  exynos_drm.h: use __u64 from linux/types.h
  nouveau_drm.h: use __u32 and __u64 from linux/types.h
  radeon_drm.h: use __u32 and __u64 from linux/types.h
  r128_drm.h: include drm/drm.h
  via_drm.h: don't include non-existing via_drmclient.h
  via_drm.h: move struct via_file_private definition to
    drivers/gpu/drm/via/via_drv.h
  savage_drm.h: include <drm/drm.h>
  include/uapi/drm/sis_drm.h: move sis_file_private to
    drivers/gpu/drm/sis/sis_drv.h
  drm/i810_drm.h: include drm/drm.h
  include/uapi/drm/vmwgfx_drm.h: use __s32, __u32 and __u64 from
    linux/types.h
  include/uapi/drm/qxl_drm.h: use __s32, __u32 and __u64 from
    linux/types.h
  include/uapi/linux/agpgart.h: include stdlib.h in userspace
  include/uapi/sound/emu10k1.h: added EMU10K1 version of DECLARE_BITMAP
    macro
  dm-log-userspace.h: use __u32, __s32 and __u64 from linux/types.h
  hsi_char.h: use __u32 from linux/types.h
  include/uapi/linux/hsi/cs-protocol.h: include linux/time.h
  ebtables.h: use __u64 from linux/types.h
  cld.h: use __u8, __u16, __s16, __u32 and __s64 from linux/types.h
  rds.h: use __u8, __u16, __s16, __u32 and __s64 from linux/types.h
  sctp.h: use __u8 and __u32 from linux/types.h
  scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h
  scsi_netlink.h: use __u8, __u16 and __u64 from linux/types.h
  scsi_netlink_fc.h: use __u16, __u32 and __u64 from linux/types.h
  hdspm.h: use __u8, __u32 and __u64 from linux/types.h instead of
    stdint.h
  gntalloc.h: use __u16, __u32 and __u64 from linux/types.h
  gntdev.h: use __u32 and __u64 from linux/types.h
  include/uapi/linux/sysctl.h: use __kernel_size_t instead of size_t
  include/uapi/asm-generic/ipcbuf.h: include linux/posix_types.h
  include/uapi/asm-generic/msgbuf.h: include asm/ipcbuf.h
  include/uapi/asm-generic/shmbuf.h: include fixes
  asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h
  include/uapi/asm-generic/signal.h: use __kernel_size_t instead of
    size_t
  include/uapi/linux/socket.h: include sys/socket.h in userspace
  include/uapi/linux/rds.h: include linux/socket.h and linux/types.h
  include/uapi/linux/if_pppox.h: include linux/if.h
  include/uapi/linux/if_tunnel.h: include linux/if.h, linux/ip.h and
    linux/in6.h
  include/uapi/linux/ipv6_route.h: include linux/in6.h
  include/uapi/linux/ipv6_route.h: include linux/in6.h
  include/uapi/linux/if_pppol2tp.h: include linux/in.h and linux/in6.h
  include/uapi/linux/if_pppox.h: include linux/in.h and linux/in6.h
  linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ definition to
    hdlc/ioctl.h
  include/uapi/linux/packet_diag.h: include linux/netdevice.h
  include/uapi/linux/llc.h: include linux/if.h
  include/uapi/linux/mqueue.h: include linux/types.h
  include/uapi/linux/mroute.h: include linux/in.h
  include/uapi/linux/dlm_netlink.h: include linux/dlmconstants.h
  include/uapi/linux/ip6_tunnel.h: include linux/if.h and linux/in6.h
  include/uapi/netfilter/*.h: fix include files for compilation
  include/uapi/linux/errqueue.h: include linux/time.h
  include/uapi/asm-generic/ucontext.h: include asm/signal.h and
    asm/sigcontext.h
  arch/x86/include/uapi/asm/signal.h: use __kernel_size_t instead of
    size_t
  include/uapi/linux/auto_fs.h: include linux/limits.h
  include/uapi/linux/openvswitch.h: use __u32 from linux/types.h
  include/uapi/linux/target_core_user.h: use __u8, __u16, __u32 and
    __u64 from linux/types.h
  include/uapi/linux/omapfb.h: use __kernel_size_t instead of size_t
  include/uapi/linux/atm_zatm.h: include linux/time.h
  include/uapi/linux/scc.h: include linux/sockios.h
  include/uapi/linux/btrfs.h: define NULL
  include/uapi/linux/kexec.h: use __kernel_size_t instead of size_t
  include/uapi/linux/reiserfs_xattr.h: use __kernel_size_t instead of
    size_t
  include/uapi/linux/patchkey.h: change #error to #warning if file
    included directly
  include/uapi/linux/coda.h: use __kernel_pid_t and add u_short etc
    definitions for userspace
  include/uapi/linux/android/binder.h: use __kernel_pid_t and
    __kernel_uid_t
  arch/x86/include/uapi/asm/sembuf.h: include linux/types.h and
    linux/ipc.h
  include/uapi/linux/dvb/video.h: remove stdint.h include
  include/uapi/mtd/mtd-user.h: remove stdint.h include
  include/uapi/linux/fuse.h: use linux/types.h also in userspace
  include/linux/ipmi-fru.h: use linux/types.h instead of stdint.h
  include/linux/sdb.h: use linux/types.h types instead of stdint.h
  include/linux/xz.h: use linux/types.h types instead of stdint.h
  include/uapi/xen/privcmd.h: fix compilation in userspace
  coda_psdev.h: move upc_req definition from uapi to kernel side headers
  include/uapi/linux/elfcore.h: remove non-compiling userspace parts
  include/uapi/linux/errqueue.h: include time.h in userspace
  arch/arm/include/uapi/asm/signal.h: use __kernel_size_t instead of
    size_t

 arch/arm/include/asm/xen/interface.h               |   2 +-
 arch/arm/include/uapi/asm/signal.h                 |   2 +-
 arch/x86/include/uapi/asm/sembuf.h                 |   3 +
 arch/x86/include/uapi/asm/signal.h                 |   2 +-
 drivers/gpu/drm/sis/sis_drv.h                      |   4 +
 drivers/gpu/drm/via/via_drv.h                      |   4 +
 include/linux/coda_psdev.h                         |  11 +
 include/linux/ipmi-fru.h                           |  31 +-
 include/linux/sdb.h                                |  62 ++-
 include/linux/xz.h                                 |  11 +-
 include/uapi/asm-generic/ipcbuf.h                  |   2 +
 include/uapi/asm-generic/msgbuf.h                  |   2 +
 include/uapi/asm-generic/sembuf.h                  |   2 +
 include/uapi/asm-generic/shmbuf.h                  |   4 +-
 include/uapi/asm-generic/signal.h                  |   2 +-
 include/uapi/asm-generic/ucontext.h                |   3 +
 include/uapi/drm/drm.h                             |   9 +-
 include/uapi/drm/drm_mode.h                        |  16 +-
 include/uapi/drm/exynos_drm.h                      |   6 +-
 include/uapi/drm/i810_drm.h                        |   2 +
 include/uapi/drm/nouveau_drm.h                     |  86 ++--
 include/uapi/drm/qxl_drm.h                         |  74 ++--
 include/uapi/drm/r128_drm.h                        |   2 +
 include/uapi/drm/radeon_drm.h                      | 128 +++---
 include/uapi/drm/savage_drm.h                      |   2 +
 include/uapi/drm/sis_drm.h                         |   4 -
 include/uapi/drm/via_drm.h                         |   7 -
 include/uapi/drm/vmwgfx_drm.h                      | 264 ++++++-------
 include/uapi/linux/agpgart.h                       |   1 +
 include/uapi/linux/android/binder.h                |   4 +-
 include/uapi/linux/atm_zatm.h                      |   1 +
 include/uapi/linux/auto_fs.h                       |   1 +
 include/uapi/linux/btrfs.h                         |   6 +
 include/uapi/linux/coda.h                          |  11 +-
 include/uapi/linux/coda_psdev.h                    |  13 -
 include/uapi/linux/dlm_netlink.h                   |   1 +
 include/uapi/linux/dm-log-userspace.h              |  43 +-
 include/uapi/linux/dvb/video.h                     |   1 -
 include/uapi/linux/elfcore.h                       |  21 +-
 include/uapi/linux/errqueue.h                      |   6 +
 include/uapi/linux/fuse.h                          | 440 ++++++++++-----------
 include/uapi/linux/hdlc/ioctl.h                    |   1 +
 include/uapi/linux/hsi/cs-protocol.h               |   1 +
 include/uapi/linux/hsi/hsi_char.h                  |  17 +-
 include/uapi/linux/if.h                            |   6 +-
 include/uapi/linux/if_pppol2tp.h                   |   3 +-
 include/uapi/linux/if_pppox.h                      |   3 +
 include/uapi/linux/if_tunnel.h                     |   3 +
 include/uapi/linux/ip6_tunnel.h                    |   2 +
 include/uapi/linux/ipv6_route.h                    |   1 +
 include/uapi/linux/kexec.h                         |   4 +-
 include/uapi/linux/llc.h                           |   1 +
 include/uapi/linux/mqueue.h                        |   2 +
 include/uapi/linux/mroute.h                        |   1 +
 include/uapi/linux/mroute6.h                       |   1 +
 include/uapi/linux/netfilter/ipset/ip_set_bitmap.h |   2 +
 include/uapi/linux/netfilter/ipset/ip_set_hash.h   |   2 +
 include/uapi/linux/netfilter/ipset/ip_set_list.h   |   2 +
 .../linux/netfilter/nf_conntrack_tuple_common.h    |   3 +
 include/uapi/linux/netfilter/xt_HMARK.h            |   1 +
 include/uapi/linux/netfilter/xt_RATEEST.h          |   1 +
 include/uapi/linux/netfilter/xt_TEE.h              |   2 +
 include/uapi/linux/netfilter/xt_TPROXY.h           |   1 +
 include/uapi/linux/netfilter/xt_hashlimit.h        |   1 +
 include/uapi/linux/netfilter/xt_ipvs.h             |   1 +
 include/uapi/linux/netfilter/xt_mac.h              |   2 +
 include/uapi/linux/netfilter/xt_osf.h              |   2 +
 include/uapi/linux/netfilter/xt_physdev.h          |   2 +-
 include/uapi/linux/netfilter/xt_policy.h           |   2 +
 include/uapi/linux/netfilter/xt_rateest.h          |   1 +
 include/uapi/linux/netfilter/xt_recent.h           |   1 +
 include/uapi/linux/netfilter/xt_sctp.h             |  12 +-
 include/uapi/linux/netfilter_arp/arp_tables.h      |   1 +
 include/uapi/linux/netfilter_bridge.h              |   1 +
 include/uapi/linux/netfilter_bridge/ebt_arp.h      |   1 +
 include/uapi/linux/netfilter_bridge/ebt_arpreply.h |   2 +
 include/uapi/linux/netfilter_bridge/ebt_ip6.h      |   1 +
 include/uapi/linux/netfilter_bridge/ebt_nat.h      |   2 +
 include/uapi/linux/netfilter_bridge/ebtables.h     |   6 +-
 include/uapi/linux/netfilter_ipv4/ip_tables.h      |   1 +
 include/uapi/linux/netfilter_ipv6/ip6_tables.h     |   1 +
 include/uapi/linux/netfilter_ipv6/ip6t_rt.h        |   2 +-
 include/uapi/linux/nfsd/cld.h                      |  14 +-
 include/uapi/linux/omapfb.h                        |   2 +-
 include/uapi/linux/openvswitch.h                   |   4 +-
 include/uapi/linux/packet_diag.h                   |   1 +
 include/uapi/linux/patchkey.h                      |   2 +-
 include/uapi/linux/rds.h                           | 103 ++---
 include/uapi/linux/reiserfs_xattr.h                |   2 +-
 include/uapi/linux/scc.h                           |   1 +
 include/uapi/linux/sctp.h                          |   8 +-
 include/uapi/linux/socket.h                        |   4 +
 include/uapi/linux/sysctl.h                        |   4 +-
 include/uapi/linux/target_core_user.h              |  22 +-
 include/uapi/mtd/mtd-user.h                        |   2 -
 include/uapi/scsi/scsi_bsg_fc.h                    |  54 +--
 include/uapi/scsi/scsi_netlink.h                   |  22 +-
 include/uapi/scsi/scsi_netlink_fc.h                |  16 +-
 include/uapi/sound/emu10k1.h                       |  14 +-
 include/uapi/sound/hdspm.h                         |  40 +-
 include/uapi/xen/gntalloc.h                        |  22 +-
 include/uapi/xen/gntdev.h                          |  34 +-
 include/uapi/xen/privcmd.h                         |  14 +-
 scripts/headers_compile_test.sh                    | 143 +++++++
 scripts/headers_install.sh                         |  14 +-
 105 files changed, 1096 insertions(+), 844 deletions(-)
 create mode 100755 scripts/headers_compile_test.sh

-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to