Skip to content

Commit 2aaef77

Browse files
crassandrewc12
authored andcommitted
Add support for ARCH=um for x86 sub-architectures
When building modules (as well as the kernel) with ARCH=um, the options -Dsetjmp=kernel_setjmp and -Dlongjmp=kernel_longjmp are passed to the C preprocessor for C files. This causes the setjmp and longjmp used in module/lua/ldo.c to be kernel_setjmp and kernel_longjmp respectively in the object file. However, the setjmp and longjmp that is intended to be called is defined in an architecture dependent assembly file under the directory module/lua/setjmp. Since it is an assembly and not a C file, the preprocessor define is not given and the names do not change. This becomes an issue when modpost is trying to create the Module.symvers and sees no defined symbol for kernel_setjmp and kernel_longjmp. To fix this, if the macro CONFIG_UML is defined, then setjmp and longjmp macros are undefined. When building with ARCH=um for x86 sub-architectures, CONFIG_X86 is not defined. Instead, CONFIG_UML_X86 is defined. Despite this, the UML x86 sub-architecture can use the same object files as the x86 architectures because the x86 sub-architecture UML kernel is running with the same instruction set as CONFIG_X86. So the modules/Kbuild build file is updated to add the same object files that CONFIG_X86 would add when CONFIG_UML_X86 is defined. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Glenn Washburn <[email protected]> Closes openzfs#13547
1 parent 4ff1133 commit 2aaef77

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/os/linux/zfs/sys/zfs_context_os.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,9 @@
3232
#define HAVE_LARGE_STACKS 1
3333
#endif
3434

35+
#if defined(CONFIG_UML)
36+
#undef setjmp
37+
#undef longjmp
38+
#endif
39+
3540
#endif

module/Kbuild.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ ICP_OBJS_PPC_PPC64 := \
138138

139139
zfs-objs += $(addprefix icp/,$(ICP_OBJS))
140140
zfs-$(CONFIG_X86) += $(addprefix icp/,$(ICP_OBJS_X86))
141+
zfs-$(CONFIG_UML_X86)+= $(addprefix icp/,$(ICP_OBJS_X86))
141142
zfs-$(CONFIG_X86_64) += $(addprefix icp/,$(ICP_OBJS_X86_64))
142143
zfs-$(CONFIG_ARM64) += $(addprefix icp/,$(ICP_OBJS_ARM64))
143144
zfs-$(CONFIG_PPC) += $(addprefix icp/,$(ICP_OBJS_PPC_PPC64))
@@ -232,6 +233,7 @@ ZCOMMON_OBJS_ARM64 := \
232233

233234
zfs-objs += $(addprefix zcommon/,$(ZCOMMON_OBJS))
234235
zfs-$(CONFIG_X86) += $(addprefix zcommon/,$(ZCOMMON_OBJS_X86))
236+
zfs-$(CONFIG_UML_X86)+= $(addprefix zcommon/,$(ZCOMMON_OBJS_X86))
235237
zfs-$(CONFIG_ARM64) += $(addprefix zcommon/,$(ZCOMMON_OBJS_ARM64))
236238

237239

@@ -457,6 +459,7 @@ ZFS_OBJS_PPC_PPC64 := \
457459

458460
zfs-objs += $(addprefix zfs/,$(ZFS_OBJS)) $(addprefix os/linux/zfs/,$(ZFS_OBJS_OS))
459461
zfs-$(CONFIG_X86) += $(addprefix zfs/,$(ZFS_OBJS_X86))
462+
zfs-$(CONFIG_UML_X86)+= $(addprefix zfs/,$(ZFS_OBJS_X86))
460463
zfs-$(CONFIG_ARM64) += $(addprefix zfs/,$(ZFS_OBJS_ARM64))
461464
zfs-$(CONFIG_PPC) += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64))
462465
zfs-$(CONFIG_PPC64) += $(addprefix zfs/,$(ZFS_OBJS_PPC_PPC64))

0 commit comments

Comments
 (0)