From f1af8ceaa9b81dfab178b8aeb55b61c63c8e8bef Mon Sep 17 00:00:00 2001 From: Petr Penzin Date: Tue, 13 Dec 2022 17:57:57 -0800 Subject: [PATCH] Add a separate install target for threaded libc (#331) Produce a different sysroot directory for threaded target. Restructure `expected` directory to correspond to the target. --- Makefile | 16 ++++++++++------ .../defined-symbols.txt | 0 .../posix => wasm32-wasi-pthread}/include-all.c | 0 .../predefined-macros.txt | 0 .../undefined-symbols.txt | 0 .../wasm32-wasi/{single => }/defined-symbols.txt | 0 expected/wasm32-wasi/{single => }/include-all.c | 0 .../{single => }/predefined-macros.txt | 0 .../{single => }/undefined-symbols.txt | 0 9 files changed, 10 insertions(+), 6 deletions(-) rename expected/{wasm32-wasi/posix => wasm32-wasi-pthread}/defined-symbols.txt (100%) rename expected/{wasm32-wasi/posix => wasm32-wasi-pthread}/include-all.c (100%) rename expected/{wasm32-wasi/posix => wasm32-wasi-pthread}/predefined-macros.txt (100%) rename expected/{wasm32-wasi/posix => wasm32-wasi-pthread}/undefined-symbols.txt (100%) rename expected/wasm32-wasi/{single => }/defined-symbols.txt (100%) rename expected/wasm32-wasi/{single => }/include-all.c (100%) rename expected/wasm32-wasi/{single => }/predefined-macros.txt (100%) rename expected/wasm32-wasi/{single => }/undefined-symbols.txt (100%) diff --git a/Makefile b/Makefile index aa9d76d..f01300d 100644 --- a/Makefile +++ b/Makefile @@ -32,10 +32,14 @@ BULK_MEMORY_THRESHOLD ?= 32 # Variables from this point on are not meant to be overridable via the # make command-line. -# Set the target variables. Multiarch triples notably omit the vendor field, -# which happens to be what we do for the main target triple too. +# Set the default WASI target triple. TARGET_TRIPLE = wasm32-wasi -MULTIARCH_TRIPLE = wasm32-wasi + +# Threaded version necessitates a different traget, as objects from different +# targets can't be mixed together while linking. +ifeq ($(THREAD_MODEL), posix) +TARGET_TRIPLE = wasm32-wasi-pthread +endif # These variables describe the locations of various files and directories in # the source tree. @@ -365,9 +369,9 @@ LIBWASI_EMULATED_SIGNAL_MUSL_OBJS = $(call objs,$(LIBWASI_EMULATED_SIGNAL_MUSL_S # These variables describe the locations of various files and # directories in the generated sysroot tree. -SYSROOT_LIB := $(SYSROOT)/lib/$(MULTIARCH_TRIPLE) +SYSROOT_LIB := $(SYSROOT)/lib/$(TARGET_TRIPLE) SYSROOT_INC = $(SYSROOT)/include -SYSROOT_SHARE = $(SYSROOT)/share/$(MULTIARCH_TRIPLE) +SYSROOT_SHARE = $(SYSROOT)/share/$(TARGET_TRIPLE) # Files from musl's include directory that we don't want to install in the # sysroot's include directory. @@ -692,7 +696,7 @@ check-symbols: startup_files libc # Check that the computed metadata matches the expected metadata. # This ignores whitespace because on Windows the output has CRLF line endings. - diff -wur "$(CURDIR)/expected/$(MULTIARCH_TRIPLE)/$(THREAD_MODEL)" "$(SYSROOT_SHARE)" + diff -wur "$(CURDIR)/expected/$(TARGET_TRIPLE)" "$(SYSROOT_SHARE)" install: finish mkdir -p "$(INSTALL_DIR)" diff --git a/expected/wasm32-wasi/posix/defined-symbols.txt b/expected/wasm32-wasi-pthread/defined-symbols.txt similarity index 100% rename from expected/wasm32-wasi/posix/defined-symbols.txt rename to expected/wasm32-wasi-pthread/defined-symbols.txt diff --git a/expected/wasm32-wasi/posix/include-all.c b/expected/wasm32-wasi-pthread/include-all.c similarity index 100% rename from expected/wasm32-wasi/posix/include-all.c rename to expected/wasm32-wasi-pthread/include-all.c diff --git a/expected/wasm32-wasi/posix/predefined-macros.txt b/expected/wasm32-wasi-pthread/predefined-macros.txt similarity index 100% rename from expected/wasm32-wasi/posix/predefined-macros.txt rename to expected/wasm32-wasi-pthread/predefined-macros.txt diff --git a/expected/wasm32-wasi/posix/undefined-symbols.txt b/expected/wasm32-wasi-pthread/undefined-symbols.txt similarity index 100% rename from expected/wasm32-wasi/posix/undefined-symbols.txt rename to expected/wasm32-wasi-pthread/undefined-symbols.txt diff --git a/expected/wasm32-wasi/single/defined-symbols.txt b/expected/wasm32-wasi/defined-symbols.txt similarity index 100% rename from expected/wasm32-wasi/single/defined-symbols.txt rename to expected/wasm32-wasi/defined-symbols.txt diff --git a/expected/wasm32-wasi/single/include-all.c b/expected/wasm32-wasi/include-all.c similarity index 100% rename from expected/wasm32-wasi/single/include-all.c rename to expected/wasm32-wasi/include-all.c diff --git a/expected/wasm32-wasi/single/predefined-macros.txt b/expected/wasm32-wasi/predefined-macros.txt similarity index 100% rename from expected/wasm32-wasi/single/predefined-macros.txt rename to expected/wasm32-wasi/predefined-macros.txt diff --git a/expected/wasm32-wasi/single/undefined-symbols.txt b/expected/wasm32-wasi/undefined-symbols.txt similarity index 100% rename from expected/wasm32-wasi/single/undefined-symbols.txt rename to expected/wasm32-wasi/undefined-symbols.txt -- 2.39.2