Re: [PATCH] Decouple build from userspace headers
From: Alexey Dobriyan <hidden>
Date: 2021-07-14 08:42:46
Also in:
linux-kbuild, lkml
On Wed, Jul 14, 2021 at 01:54:59PM +0900, Masahiro Yamada wrote:
On Wed, Jul 14, 2021 at 4:47 AM Alexey Dobriyan [off-list ref] wrote:quoted
In theory, userspace headers can be under incompatible license. Linux by virtue of being OS kernel is fully independent piece of code and should not require anything from userspace.As far as I know, <stdarg.h> was the only exception, which was borrowed from the compiler. I like this as long as: - license is clear (please add SPDX tag to the new header) - it works for both gcc and clang (I guess the answer is yes)
It should. clang version is essentially the same (with less prehistoric macrology).
I think removing <stdbool.h> and <stddef.h> are non-controversial. Mayby, you can split it into 1/2.quoted
For this: * ship minimal <stdarg.h> 2 types, 4 macros * delete "-isystem" This is what enables leakage. * fixup compilation where necessary. Signed-off-by: Alexey Dobriyan <redacted> --- Makefile | 2 +- arch/um/include/shared/irq_user.h | 1 - arch/um/os-Linux/signal.c | 2 +- crypto/aegis128-neon-inner.c | 2 -- drivers/net/wwan/iosm/iosm_ipc_imem.h | 1 - drivers/pinctrl/aspeed/pinmux-aspeed.h | 1 - drivers/staging/media/atomisp/pci/hive_isp_css_common/host/isp_local.h | 2 -- include/stdarg.h | 9 +++++++++ sound/aoa/codecs/onyx.h | 1 - sound/aoa/codecs/tas.c | 1 - 10 files changed, 11 insertions(+), 11 deletions(-)quoted
new file mode 100644--- /dev/null +++ b/include/stdarg.h@@ -0,0 +1,9 @@This is a new file, so please add the SPDX tag. What project did you copy the code from? If gcc, is it GPL v3 (but not compatible for GPL v2) ?
It is GPL 2, brought to you by Debian! I'll add a link. http://archive.debian.org/debian/pool/main/g/gcc-4.2/
If clang, is it SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception Or, can we license this small portion of code as GPL v2?quoted
+#ifndef _LINUX_STDARG_H +#define _LINUX_STDARG_H +typedef __builtin_va_list __gnuc_va_list;Where is __gnuc_va_list needed? BTW, once this is accepted, I'd like to change all <stdarg.h> to <linux/stdarg.h>.
Yes. I've just realised <stdarg.h> is the wrong place: gcc -Wp,-MMD,scripts/selinux/genheaders/.genheaders.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I/home/ad/linux/linux-1/include/uapi -I/home/ad/linux/linux-1/include -I/home/ad/linux/linux-1/security/selinux/include -I ./scripts/selinux/genheaders -o scripts/selinux/genheaders/genheaders /home/ad/linux/linux-1/scripts/selinux/genheaders/genheaders.c In file included from /home/ad/linux/linux-1/scripts/selinux/genheaders/genheaders.c:6: /usr/include/stdio.h:52:9: error: unknown type name ‘__gnuc_va_list’ 52 | typedef __gnuc_va_list va_list; Or maybe <stdarg.h> is the right place by passing all those include directories to userspace helpers is the wrong thing to do.