@@ -233,6 +233,83 @@ override MUSL_PRINTSCAN_LONG_DOUBLE_OBJS = $(patsubst %.o,%.long-double.o,$(MUSL
233233override MUSL_PRINTSCAN_NO_FLOATING_POINT_OBJS = $(patsubst % .o,% .no-floating-point.o,$(MUSL_PRINTSCAN_OBJS ) )
234234override LIBWASI_EMULATED_MMAN_OBJS = $(call objs,$(LIBWASI_EMULATED_MMAN_SOURCES ) )
235235
236+ # Files from musl's include directory that we don't want to install in the
237+ # sysroot's include directory.
238+ override MUSL_OMIT_HEADERS :=
239+
240+ # Remove files which aren't headers (we generate alltypes.h below).
241+ override MUSL_OMIT_HEADERS += \
242+ "bits/syscall.h.in" \
243+ "bits/alltypes.h.in" \
244+ "alltypes.h.in"
245+
246+ # Use the WASI errno definitions.
247+ override MUSL_OMIT_HEADERS += \
248+ "bits/errno.h"
249+
250+ # Remove headers that aren't supported yet or that aren't relevant for WASI.
251+ override MUSL_OMIT_HEADERS += \
252+ "sys/procfs.h" \
253+ "sys/user.h" \
254+ "sys/kd.h" "sys/vt.h" "sys/soundcard.h" "sys/sem.h" \
255+ "sys/shm.h" "sys/msg.h" "sys/ipc.h" "sys/ptrace.h" \
256+ "sys/statfs.h" \
257+ "bits/kd.h" "bits/vt.h" "bits/soundcard.h" "bits/sem.h" \
258+ "bits/shm.h" "bits/msg.h" "bits/ipc.h" "bits/ptrace.h" \
259+ "bits/statfs.h" \
260+ "sys/vfs.h" \
261+ "sys/statvfs.h" \
262+ "syslog.h" "sys/syslog.h" \
263+ "wait.h" "sys/wait.h" \
264+ "ucontext.h" "sys/ucontext.h" \
265+ "paths.h" \
266+ "utmp.h" "utmpx.h" \
267+ "lastlog.h" \
268+ "sys/acct.h" \
269+ "sys/cachectl.h" \
270+ "sys/epoll.h" "sys/reboot.h" "sys/swap.h" \
271+ "sys/sendfile.h" "sys/inotify.h" \
272+ "sys/quota.h" \
273+ "sys/klog.h" \
274+ "sys/fsuid.h" \
275+ "sys/io.h" \
276+ "sys/prctl.h" \
277+ "sys/mtio.h" \
278+ "sys/mount.h" \
279+ "sys/fanotify.h" \
280+ "sys/personality.h" \
281+ "elf.h" "link.h" "bits/link.h" \
282+ "scsi/scsi.h" "scsi/scsi_ioctl.h" "scsi/sg.h" \
283+ "sys/auxv.h" \
284+ "pwd.h" "shadow.h" "grp.h" \
285+ "mntent.h" \
286+ "netdb.h" \
287+ "resolv.h" \
288+ "pty.h" \
289+ "dlfcn.h" \
290+ "setjmp.h" \
291+ "ulimit.h" \
292+ "sys/xattr.h" \
293+ "wordexp.h" \
294+ "spawn.h" \
295+ "sys/membarrier.h" \
296+ "sys/signalfd.h" \
297+ "termios.h" \
298+ "sys/termios.h" \
299+ "bits/termios.h" \
300+ "net/if.h" \
301+ "net/if_arp.h" \
302+ "net/ethernet.h" \
303+ "net/route.h" \
304+ "netinet/if_ether.h" \
305+ "netinet/ether.h" \
306+ "sys/timerfd.h"
307+
308+ ifeq ($(THREAD_MODEL ) , single)
309+ # Remove headers not supported in single-threaded mode.
310+ override MUSL_OMIT_HEADERS += "aio.h" "pthread.h"
311+ endif
312+
236313default : check
237314
238315$(SYSROOT_LIB ) /libc.a : $(LIBC_OBJS )
@@ -323,95 +400,8 @@ include_dirs:
323400 cp -r "$(LIBC_TOP_HALF_MUSL_DIR)"/arch/generic/bits/* "$(SYSROOT_INC)/bits"
324401 cp -r "$(LIBC_TOP_HALF_MUSL_DIR)"/arch/wasm32/bits/* "$(SYSROOT_INC)/bits"
325402
326- # Remove files that aren't headers or that aren't supported yet or that aren't relevant for wasm.
327- $(RM) "$(SYSROOT_INC)/bits/syscall.h.in" \
328- "$(SYSROOT_INC)/bits/alltypes.h.in" \
329- "$(SYSROOT_INC)/alltypes.h.in" \
330- "$(SYSROOT_INC)/sys/procfs.h" \
331- "$(SYSROOT_INC)/sys/user.h" \
332- "$(SYSROOT_INC)/sys/kd.h" \
333- "$(SYSROOT_INC)/bits/kd.h" \
334- "$(SYSROOT_INC)/sys/vt.h" \
335- "$(SYSROOT_INC)/bits/vt.h" \
336- "$(SYSROOT_INC)/sys/soundcard.h" \
337- "$(SYSROOT_INC)/bits/soundcard.h" \
338- "$(SYSROOT_INC)/sys/sem.h" \
339- "$(SYSROOT_INC)/bits/sem.h" \
340- "$(SYSROOT_INC)/sys/statfs.h" \
341- "$(SYSROOT_INC)/sys/vfs.h" \
342- "$(SYSROOT_INC)/bits/statfs.h" \
343- "$(SYSROOT_INC)/sys/statvfs.h" \
344- "$(SYSROOT_INC)/sys/shm.h" \
345- "$(SYSROOT_INC)/bits/shm.h" \
346- "$(SYSROOT_INC)/sys/msg.h" \
347- "$(SYSROOT_INC)/bits/msg.h" \
348- "$(SYSROOT_INC)/sys/ipc.h" \
349- "$(SYSROOT_INC)/bits/ipc.h" \
350- "$(SYSROOT_INC)/syslog.h" \
351- "$(SYSROOT_INC)/sys/syslog.h" \
352- "$(SYSROOT_INC)/paths.h" \
353- "$(SYSROOT_INC)/utmp.h" \
354- "$(SYSROOT_INC)/utmpx.h" \
355- "$(SYSROOT_INC)/lastlog.h" \
356- "$(SYSROOT_INC)/sys/acct.h" \
357- "$(SYSROOT_INC)/sys/cachectl.h" \
358- "$(SYSROOT_INC)/sys/epoll.h" \
359- "$(SYSROOT_INC)/sys/ptrace.h" \
360- "$(SYSROOT_INC)/bits/ptrace.h" \
361- "$(SYSROOT_INC)/sys/reboot.h" \
362- "$(SYSROOT_INC)/sys/swap.h" \
363- "$(SYSROOT_INC)/sys/sendfile.h" \
364- "$(SYSROOT_INC)/sys/quota.h" \
365- "$(SYSROOT_INC)/sys/inotify.h" \
366- "$(SYSROOT_INC)/sys/klog.h" \
367- "$(SYSROOT_INC)/sys/fsuid.h" \
368- "$(SYSROOT_INC)/sys/io.h" \
369- "$(SYSROOT_INC)/sys/prctl.h" \
370- "$(SYSROOT_INC)/sys/mtio.h" \
371- "$(SYSROOT_INC)/sys/mount.h" \
372- "$(SYSROOT_INC)/sys/fanotify.h" \
373- "$(SYSROOT_INC)/sys/personality.h" \
374- "$(SYSROOT_INC)/sys/wait.h" \
375- "$(SYSROOT_INC)/wait.h" \
376- "$(SYSROOT_INC)/bits/errno.h" \
377- "$(SYSROOT_INC)/bits/link.h" \
378- "$(SYSROOT_INC)/link.h" \
379- "$(SYSROOT_INC)/elf.h" \
380- "$(SYSROOT_INC)/scsi/scsi.h" \
381- "$(SYSROOT_INC)/scsi/scsi_ioctl.h" \
382- "$(SYSROOT_INC)/scsi/sg.h" \
383- "$(SYSROOT_INC)/sys/auxv.h" \
384- "$(SYSROOT_INC)/setjmp.h" \
385- "$(SYSROOT_INC)/pwd.h" \
386- "$(SYSROOT_INC)/shadow.h" \
387- "$(SYSROOT_INC)/grp.h" \
388- "$(SYSROOT_INC)/mntent.h" \
389- "$(SYSROOT_INC)/netdb.h" \
390- "$(SYSROOT_INC)/resolv.h" \
391- "$(SYSROOT_INC)/pty.h" \
392- "$(SYSROOT_INC)/dlfcn.h" \
393- "$(SYSROOT_INC)/ulimit.h" \
394- "$(SYSROOT_INC)/sys/xattr.h" \
395- "$(SYSROOT_INC)/wordexp.h" \
396- "$(SYSROOT_INC)/spawn.h" \
397- "$(SYSROOT_INC)/ucontext.h" \
398- "$(SYSROOT_INC)/sys/ucontext.h" \
399- "$(SYSROOT_INC)/sys/membarrier.h" \
400- "$(SYSROOT_INC)/sys/signalfd.h" \
401- "$(SYSROOT_INC)/termios.h" \
402- "$(SYSROOT_INC)/sys/termios.h" \
403- "$(SYSROOT_INC)/bits/termios.h" \
404- "$(SYSROOT_INC)/net/if.h" \
405- "$(SYSROOT_INC)/net/if_arp.h" \
406- "$(SYSROOT_INC)/net/ethernet.h" \
407- "$(SYSROOT_INC)/net/route.h" \
408- "$(SYSROOT_INC)/netinet/if_ether.h" \
409- "$(SYSROOT_INC)/netinet/ether.h" \
410- "$(SYSROOT_INC)/sys/timerfd.h"
411- ifeq ($(THREAD_MODEL ) , single)
412- $(RM) "$(SYSROOT_INC)/aio.h" \
413- "$(SYSROOT_INC)/pthread.h"
414- endif
403+ # Remove selected header files.
404+ $(RM) $(patsubst %,$(SYSROOT_INC)/%,$(MUSL_OMIT_HEADERS))
415405
416406ifeq ($(BUILD_LIBC_BOTTOM_HALF ) ,no)
417407override CRT_SOURCES = $(BASICS_CRT_SOURCES )
0 commit comments