@@ -42,7 +42,7 @@ include $(srctree)/$(HOST_DIR)/Makefile.um
core-y += $(HOST_DIR)/um/
SHARED_HEADERS := $(ARCH_DIR)/include/shared
-ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS)
+ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS) -I$(objtree)/$(SHARED_HEADERS)
ARCH_INCLUDE += -I$(srctree)/$(HOST_DIR)/um/shared
KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
@@ -70,10 +70,13 @@ KBUILD_AFLAGS += $(ARCH_INCLUDE)
USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
$(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \
- -D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \
- -idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__ \
- -include $(srctree)/include/linux/compiler-version.h \
- -include $(srctree)/include/linux/kconfig.h
+ -idirafter $(srctree)/tools/include \
+ -D__UM_HOST__ \
+ -include $(srctree)/tools/include/linux/compiler.h \
+ -include $(srctree)/tools/include/linux/kconfig.h \
+ -include $(objtree)/include/generated/autoconf.h \
+ -include $(srctree)/include/linux/kern_levels.h \
+ -include $(srctree)/$(ARCH_DIR)/include/shared/user.h
#This will adjust *FLAGS accordingly to the platform.
include $(srctree)/$(ARCH_DIR)/Makefile-os-Linux
@@ -116,6 +119,9 @@ archheaders:
archprepare:
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
+ $(Q)mkdir -p $(ARCH_DIR)/include/shared/generated
+ $(Q)ln -fs ../../../../../include/generated/user_constants.h $(ARCH_DIR)/include/shared/generated/
+ $(Q)ln -fs ../../../../../include/generated/asm-offsets.h $(ARCH_DIR)/include/shared/generated/
LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
LINK-$(CONFIG_LD_SCRIPT_DYN) += -no-pie
@@ -147,7 +153,7 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) $(CC_FLAGS_
# When cleaning we don't include .config, so we don't include
# TT or skas makefiles and don't clean skas_ptregs.h.
CLEAN_FILES += linux x.i gmon.out
-MRPROPER_FILES += $(HOST_DIR)/include/generated
+MRPROPER_FILES += $(HOST_DIR)/include/generated $(ARCH_DIR)/include/shared/generated
archclean:
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
@@ -41,7 +41,7 @@
typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);
-#include <linux/compiler_types.h>
+#define __section(section) __attribute__((__section__(section)))
/* These are for everybody (although not all archs will actually
discard it in modules) */
@@ -16,13 +16,8 @@
*/
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-/* This is to get size_t and NULL */
-#ifndef __UM_HOST__
#include <linux/types.h>
-#else
#include <stddef.h>
-#include <sys/types.h>
-#endif
extern void panic(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
@@ -5,6 +5,7 @@
#include <sysdep/stub.h>
+#include <linux/init.h>
#include <linux/futex.h>
#include <sys/socket.h>
#include <errno.h>
@@ -4,8 +4,8 @@
#include <asm/unistd.h>
#include <sysdep/stub.h>
#include <stub-data.h>
-#include <linux/filter.h>
-#include <linux/seccomp.h>
+#include <uapi/linux/filter.h>
+#include <uapi/linux/seccomp.h>
#include <generated/asm-offsets.h>
void _start(void);
@@ -29,9 +29,7 @@
#include <sysdep/stub.h>
#include <sysdep/mcontext.h>
#include <linux/futex.h>
-#include <linux/threads.h>
#include <timetravel.h>
-#include <asm-generic/rwonce.h>
#include "../internal.h"
int is_skas_winch(int pid, int fd, void *data)
@@ -204,7 +202,7 @@ void wait_stub_done_seccomp(struct mm_id *mm_idp, int running, int wait_sigsys)
* Either way, if PID is negative, then we have no
* choice but to kill the task.
*/
- if (__READ_ONCE(mm_idp->pid) < 0)
+ if (READ_ONCE(mm_idp->pid) < 0)
goto out_kill;
ret = syscall(__NR_futex, &data->futex,
@@ -217,7 +215,7 @@ void wait_stub_done_seccomp(struct mm_id *mm_idp, int running, int wait_sigsys)
}
} while (data->futex == FUTEX_IN_CHILD);
- if (__READ_ONCE(mm_idp->pid) < 0)
+ if (READ_ONCE(mm_idp->pid) < 0)
goto out_kill;
running = 0;
@@ -28,8 +28,8 @@
#include <stdbool.h>
#include <stub-data.h>
#include <sys/prctl.h>
-#include <linux/seccomp.h>
-#include <linux/filter.h>
+#include <uapi/linux/seccomp.h>
+#include <uapi/linux/filter.h>
#include <sysdep/mcontext.h>
#include <sysdep/stub.h>
#include <registers.h>
@@ -9,7 +9,7 @@ USER_OBJS += $(filter %_user.o,$(obj-y) $(USER_SINGLE_OBJS))
USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
$(USER_OBJS:.o=.%): \
- c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) -include $(srctree)/include/linux/kern_levels.h -include user.h $(CFLAGS_$(basetarget).o)
+ c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(basetarget).o)
# These are like USER_OBJS but filter USER_CFLAGS through unprofile instead of
# using it directly.
@@ -38,8 +38,10 @@ subarch-$(CONFIG_MODULES) += ../kernel/module.o
USER_OBJS := bugs_$(BITS).o ptrace_user.o fault.o
-$(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
- -Iarch/x86/include/generated
+$(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
+ -Iarch/x86/include/generated \
+ -include $(srctree)/include/linux/kbuild.h
+
targets += user-offsets.s
include/generated/user_constants.h: $(obj)/user-offsets.s FORCE
@@ -8,7 +8,6 @@
#define __FRAME_OFFSETS
#include <linux/ptrace.h>
#include <asm/types.h>
-#include <linux/kbuild.h>
#define DEFINE_LONGS(sym, val) \
COMMENT(#val " / sizeof(unsigned long)"); \