Skip to content

Commit f2310b6

Browse files
committed
Merge tag 'nolibc-20251130-for-6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc
Pull nolibc updates from Thomas Weißschuh: - Preparations to the use of nolibc in UML: - Cleanup of sparse warnings - Library mode without _start() - More consistency when disabling errno - Unconditional installation of all architecture support files - Always 64-bit wide ino_t and off_t - Various cleanups and bug fixes * tag 'nolibc-20251130-for-6.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/nolibc/linux-nolibc: (25 commits) selftests/nolibc: error out on linker warnings selftests/nolibc: use lld to link loongarch binaries tools/nolibc: remove more __nolibc_enosys() fallbacks tools/nolibc: remove now superfluous overflow check in llseek tools/nolibc: use 64-bit off_t tools/nolibc: prefer the llseek syscall tools/nolibc: handle 64-bit off_t for llseek tools/nolibc: use 64-bit ino_t tools/nolibc: avoid using plain integer as NULL pointer tools/nolibc: add support for fchdir() tools/nolibc: clean up outdated comments in generic arch.h tools/nolibc: make the "headers" target install all supported archs tools/nolibc: add the more portable inttypes.h tools/nolibc: provide the portable sys/select.h tools/nolibc: add missing memchr() to string.h tools/nolibc: fix misleading help message regarding installation path tools/nolibc: add uio.h with readv and writev tools/nolibc: add option to disable runtime tools/nolibc: use __fallthrough__ rather than fallthrough tools/nolibc: implement %m if errno is not defined ...
2 parents 82d7a9d + 1d57346 commit f2310b6

37 files changed

Lines changed: 290 additions & 163 deletions

tools/include/nolibc/Makefile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ else
2323
Q=@
2424
endif
2525

26-
arch_file := arch-$(ARCH).h
26+
arch_files := arch.h $(wildcard arch-*.h)
2727
all_files := \
2828
compiler.h \
2929
crt.h \
@@ -33,6 +33,7 @@ all_files := \
3333
errno.h \
3434
fcntl.h \
3535
getopt.h \
36+
inttypes.h \
3637
limits.h \
3738
math.h \
3839
nolibc.h \
@@ -56,12 +57,14 @@ all_files := \
5657
sys/random.h \
5758
sys/reboot.h \
5859
sys/resource.h \
60+
sys/select.h \
5961
sys/stat.h \
6062
sys/syscall.h \
6163
sys/sysmacros.h \
6264
sys/time.h \
6365
sys/timerfd.h \
6466
sys/types.h \
67+
sys/uio.h \
6568
sys/utsname.h \
6669
sys/wait.h \
6770
time.h \
@@ -79,7 +82,7 @@ help:
7982
@echo "Supported targets under nolibc:"
8083
@echo " all call \"headers\""
8184
@echo " clean clean the sysroot"
82-
@echo " headers prepare a sysroot in tools/include/nolibc/sysroot"
85+
@echo " headers prepare a multi-arch sysroot in \$${OUTPUT}sysroot"
8386
@echo " headers_standalone like \"headers\", and also install kernel headers"
8487
@echo " help this help"
8588
@echo ""
@@ -90,18 +93,11 @@ help:
9093
@echo " OUTPUT = $(OUTPUT)"
9194
@echo ""
9295

96+
# installs headers for all archs at once.
9397
headers:
94-
$(Q)mkdir -p $(OUTPUT)sysroot
95-
$(Q)mkdir -p $(OUTPUT)sysroot/include
96-
$(Q)cp --parents $(all_files) $(OUTPUT)sysroot/include/
97-
$(Q)if [ "$(ARCH)" = "i386" -o "$(ARCH)" = "x86_64" ]; then \
98-
cat arch-x86.h; \
99-
elif [ -e "$(arch_file)" ]; then \
100-
cat $(arch_file); \
101-
else \
102-
echo "Fatal: architecture $(ARCH) not yet supported by nolibc." >&2; \
103-
exit 1; \
104-
fi > $(OUTPUT)sysroot/include/arch.h
98+
$(Q)mkdir -p "$(OUTPUT)sysroot"
99+
$(Q)mkdir -p "$(OUTPUT)sysroot/include"
100+
$(Q)cp --parents $(arch_files) $(all_files) "$(OUTPUT)sysroot/include/"
105101

106102
headers_standalone: headers
107103
$(Q)$(MAKE) -C $(srctree) headers

tools/include/nolibc/arch-arm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
_arg1; \
185185
})
186186

187+
#ifndef NOLIBC_NO_RUNTIME
187188
/* startup code */
188189
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
189190
{
@@ -193,5 +194,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
193194
);
194195
__nolibc_entrypoint_epilogue();
195196
}
197+
#endif /* NOLIBC_NO_RUNTIME */
196198

197199
#endif /* _NOLIBC_ARCH_ARM_H */

tools/include/nolibc/arch-arm64.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
_arg1; \
142142
})
143143

144+
#ifndef NOLIBC_NO_RUNTIME
144145
/* startup code */
145146
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
146147
{
@@ -150,4 +151,5 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
150151
);
151152
__nolibc_entrypoint_epilogue();
152153
}
154+
#endif /* NOLIBC_NO_RUNTIME */
153155
#endif /* _NOLIBC_ARCH_ARM64_H */

tools/include/nolibc/arch-loongarch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@
142142
_arg1; \
143143
})
144144

145+
#ifndef NOLIBC_NO_RUNTIME
145146
/* startup code */
146147
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
147148
{
@@ -151,5 +152,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
151152
);
152153
__nolibc_entrypoint_epilogue();
153154
}
155+
#endif /* NOLIBC_NO_RUNTIME */
154156

155157
#endif /* _NOLIBC_ARCH_LOONGARCH_H */

tools/include/nolibc/arch-m68k.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
_num; \
129129
})
130130

131+
#ifndef NOLIBC_NO_RUNTIME
131132
void _start(void);
132133
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
133134
{
@@ -137,5 +138,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
137138
);
138139
__nolibc_entrypoint_epilogue();
139140
}
141+
#endif /* NOLIBC_NO_RUNTIME */
140142

141143
#endif /* _NOLIBC_ARCH_M68K_H */

tools/include/nolibc/arch-mips.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245

246246
#endif /* _ABIO32 */
247247

248+
#ifndef NOLIBC_NO_RUNTIME
248249
/* startup code, note that it's called __start on MIPS */
249250
void __start(void);
250251
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector __start(void)
@@ -266,5 +267,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector __
266267
);
267268
__nolibc_entrypoint_epilogue();
268269
}
270+
#endif /* NOLIBC_NO_RUNTIME */
269271

270272
#endif /* _NOLIBC_ARCH_MIPS_H */

tools/include/nolibc/arch-powerpc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
#endif
184184
#endif /* !__powerpc64__ */
185185

186+
#ifndef NOLIBC_NO_RUNTIME
186187
/* startup code */
187188
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
188189
{
@@ -215,5 +216,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
215216
#endif
216217
__nolibc_entrypoint_epilogue();
217218
}
219+
#endif /* NOLIBC_NO_RUNTIME */
218220

219221
#endif /* _NOLIBC_ARCH_POWERPC_H */

tools/include/nolibc/arch-riscv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
_arg1; \
140140
})
141141

142+
#ifndef NOLIBC_NO_RUNTIME
142143
/* startup code */
143144
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
144145
{
@@ -152,5 +153,6 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
152153
);
153154
__nolibc_entrypoint_epilogue();
154155
}
156+
#endif /* NOLIBC_NO_RUNTIME */
155157

156158
#endif /* _NOLIBC_ARCH_RISCV_H */

tools/include/nolibc/arch-s390.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
_arg1; \
140140
})
141141

142+
#ifndef NOLIBC_NO_RUNTIME
142143
/* startup code */
143144
void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _start(void)
144145
{
@@ -150,6 +151,7 @@ void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protector _s
150151
);
151152
__nolibc_entrypoint_epilogue();
152153
}
154+
#endif /* NOLIBC_NO_RUNTIME */
153155

154156
struct s390_mmap_arg_struct {
155157
unsigned long addr;

tools/include/nolibc/arch-sh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
_ret; \
141141
})
142142

143+
#ifndef NOLIBC_NO_RUNTIME
143144
/* startup code */
144145
void _start_wrapper(void);
145146
void __attribute__((weak,noreturn)) __nolibc_entrypoint __no_stack_protector _start_wrapper(void)
@@ -158,5 +159,6 @@ void __attribute__((weak,noreturn)) __nolibc_entrypoint __no_stack_protector _st
158159
);
159160
__nolibc_entrypoint_epilogue();
160161
}
162+
#endif /* NOLIBC_NO_RUNTIME */
161163

162164
#endif /* _NOLIBC_ARCH_SH_H */

0 commit comments

Comments
 (0)