Skip to content

kbuild: use target compiler for user binaries in samples/

Sam Ravnborg linux-kbuild lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest6 patches 13 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6kbuild: add support for building userspace api programsDocumentation/kbuild/kbuild.txt Documentation/kbuild/makefiles.txt Makefile +6 more+172 -512 replies
2/6samples: refactor Makefilesamples/Makefile+13 -24 replies
3/6samples: use uapiprogs support for seccompsamples/Makefile samples/seccomp/Makefile+3 -473 replies
4/6samples: use uapiprogs support for hidrawsamples/Makefile samples/hidraw/Makefile+2 -110 replies
5/6samples: fix warnings in uhid-examplesamples/uhid/uhid-example.c+2 -20 replies
6/6samples: use uapiprogs support for uhidsamples/Makefile samples/uhid/Makefile samples/uhid/uhid-example.c+6 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/6] kbuild: use target compiler for user binaries in samples/

[PATCH v2 0/6] kbuild: use target compiler for user binaries in samples/

The user-space binaries build in samples/ uses the installed headers for the kernel.
Therefore it is wrong that they use the host compiler to build the samples.

This set of patches add kbuild support for building the userspace programs.
They are build with same endian and bit-size as the kernel, so in other words no support for buildign 32 bit userspace for a 64 bit kernel.
The majority of the patch is the Documentation changes, especially because a new chapter was added.

NOTE: This will likely break the build if the toolchain used do not include a libc. Let's see how much noise this creates.

I have included a few moe people in this submission as I assume this has their interest.

Michal - I hope you can take this via the kbuild#misc tree when any feedback has been addressed.

Changes since first posting (https://lkml.org/lkml/2013/3/31/74):
- Use $(biarch) in X86_32 (feedback from Michael Marek)
- Drop sub-directory support (feedback from Michael Marek)
o This simplified the uapi support a lot
- Fix clean support (feedback from Michael Marek)
- Added documentation to Documentation/kbuild/
- Use $(CC) as there is no need for a dedicated UAPICC
- Prefer foobar-y over foobar-objs for specifying .o files for a binary
- Move cc options to Makefile.uapiprogs and only use -Wall
- Use -isystem to include installed uapi headers before headers provided by the installed libc
- Divided up in smaller patches to ease review

Sam

Sam Ravnborg (6):
kbuild: add support for building userspace api programs
samples: refactor Makefile
samples: use uapiprogs support for seccomp
samples: use uapiprogs support for hidraw
samples: fix warnings in uhid-example
samples: use uapiprogs support for uhid

 Documentation/kbuild/kbuild.txt    |   5 ++
 Documentation/kbuild/makefiles.txt | 132 ++++++++++++++++++++++++-------------
 Makefile                           |   4 ++
 arch/s390/Makefile                 |   2 +
 arch/sparc/Makefile                |   2 +
 arch/x86/Makefile                  |   2 +
 samples/Makefile                   |  16 ++++-
 samples/hidraw/Makefile            |  11 +---
 samples/seccomp/Makefile           |  48 +-------------
 samples/uhid/Makefile              |  11 +---
 samples/uhid/uhid-example.c        |   9 ++-
 scripts/Makefile.build             |   4 ++
 scripts/Makefile.clean             |   9 +--
 scripts/Makefile.uapiprogs         |  63 ++++++++++++++++++
 14 files changed, 196 insertions(+), 122 deletions(-)