mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 15:58:47 +00:00
tools/nolibc: also mention how to build by just setting the include path
Now that a few basic include files are provided, some simple portable programs may build, which will save them from having to surround their includes with #ifndef NOLIBC. This patch mentions how to proceed, and enumerates the list of files that are covered. A comprehensive list of required include files is available here: https://en.cppreference.com/w/c/header Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
cec1505321
commit
c4486e9728
@ -57,22 +57,32 @@
|
|||||||
* having to specify anything.
|
* having to specify anything.
|
||||||
*
|
*
|
||||||
* Finally some very common libc-level functions are provided. It is the case
|
* Finally some very common libc-level functions are provided. It is the case
|
||||||
* for a few functions usually found in string.h, ctype.h, or stdlib.h. Nothing
|
* for a few functions usually found in string.h, ctype.h, or stdlib.h.
|
||||||
* is currently provided regarding stdio emulation.
|
|
||||||
*
|
*
|
||||||
* The macro NOLIBC is always defined, so that it is possible for a program to
|
* The nolibc.h file is only a convenient entry point which includes all other
|
||||||
* check this macro to know if it is being built against and decide to disable
|
* files. It also defines the NOLIBC macro, so that it is possible for a
|
||||||
* some features or simply not to include some standard libc files.
|
* program to check this macro to know if it is being built against and decide
|
||||||
*
|
* to disable some features or simply not to include some standard libc files.
|
||||||
* Ideally this file should be split in multiple files for easier long term
|
|
||||||
* maintenance, but provided as a single file as it is now, it's quite
|
|
||||||
* convenient to use. Maybe some variations involving a set of includes at the
|
|
||||||
* top could work.
|
|
||||||
*
|
*
|
||||||
* A simple static executable may be built this way :
|
* A simple static executable may be built this way :
|
||||||
* $ gcc -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \
|
* $ gcc -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \
|
||||||
* -static -include nolibc.h -o hello hello.c -lgcc
|
* -static -include nolibc.h -o hello hello.c -lgcc
|
||||||
*
|
*
|
||||||
|
* Simple programs meant to be reasonably portable to various libc and using
|
||||||
|
* only a few common includes, may also be built by simply making the include
|
||||||
|
* path point to the nolibc directory:
|
||||||
|
* $ gcc -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib \
|
||||||
|
* -I../nolibc -o hello hello.c -lgcc
|
||||||
|
*
|
||||||
|
* The available standard (but limited) include files are:
|
||||||
|
* ctype.h, errno.h, signal.h, stdio.h, stdlib.h, string.h, time.h
|
||||||
|
*
|
||||||
|
* In addition, the following ones are expected to be provided by the compiler:
|
||||||
|
* float.h, stdarg.h, stddef.h
|
||||||
|
*
|
||||||
|
* The following ones which are part to the C standard are not provided:
|
||||||
|
* assert.h, locale.h, math.h, setjmp.h, limits.h
|
||||||
|
*
|
||||||
* A very useful calling convention table may be found here :
|
* A very useful calling convention table may be found here :
|
||||||
* http://man7.org/linux/man-pages/man2/syscall.2.html
|
* http://man7.org/linux/man-pages/man2/syscall.2.html
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user