Skip to content

Commit a7a239f

Browse files
committed
generate separate .so files for emulated features
Signed-off-by: Joel Dice <[email protected]>
1 parent 0a5a707 commit a7a239f

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

Makefile

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,17 +485,18 @@ LIBC_BOTTOM_HALF_ALL_SO_OBJS = $(patsubst %.o,%.pic.o,$(LIBC_BOTTOM_HALF_ALL_OBJ
485485
LIBC_TOP_HALF_ALL_SO_OBJS = $(patsubst %.o,%.pic.o,$(LIBC_TOP_HALF_ALL_OBJS))
486486

487487
# TODO: specify SDK version, e.g. libc.so.wasi-sdk-21, as SO_NAME once `wasm-ld` supports it
488-
$(SYSROOT_LIB)/libc.so: $(SYSROOT_LIB)/libc.so.a $(BUILTINS_LIB)
488+
$(SYSROOT_LIB)/%.so: $(OBJDIR)/%.so.a $(BUILTINS_LIB)
489489
$(CC) -nostdlib -shared -o $@ -Wl,--whole-archive $< -Wl,--no-whole-archive $(BUILTINS_LIB)
490490

491-
$(SYSROOT_LIB)/libc.so.a: \
492-
$(LIBC_SO_OBJS) \
493-
$(MUSL_PRINTSCAN_LONG_DOUBLE_SO_OBJS) \
494-
$(LIBWASI_EMULATED_MMAN_SO_OBJS) \
495-
$(LIBWASI_EMULATED_PROCESS_CLOCKS_SO_OBJS) \
496-
$(LIBWASI_EMULATED_GETPID_SO_OBJS) \
497-
$(LIBWASI_EMULATED_SIGNAL_SO_OBJS) \
498-
$(LIBWASI_EMULATED_SIGNAL_MUSL_SO_OBJS)
491+
$(OBJDIR)/libc.so.a: $(LIBC_SO_OBJS) $(MUSL_PRINTSCAN_LONG_DOUBLE_SO_OBJS)
492+
493+
$(OBJDIR)/libwasi-emulated-mman.so.a: $(LIBWASI_EMULATED_MMAN_SO_OBJS)
494+
495+
$(OBJDIR)/libwasi-emulated-process-clocks.so.a: $(LIBWASI_EMULATED_PROCESS_CLOCKS_SO_OBJS)
496+
497+
$(OBJDIR)/libwasi-emulated-getpid.so.a: $(LIBWASI_EMULATED_GETPID_SO_OBJS)
498+
499+
$(OBJDIR)/libwasi-emulated-signal.so.a: $(LIBWASI_EMULATED_SIGNAL_SO_OBJS) $(LIBWASI_EMULATED_SIGNAL_MUSL_SO_OBJS)
499500

500501
$(SYSROOT_LIB)/libc.a: $(LIBC_OBJS)
501502

@@ -633,7 +634,12 @@ startup_files: include_dirs $(LIBC_BOTTOM_HALF_CRT_OBJS)
633634
# code, and I'm not sure how to make it position-independent. Once we've done
634635
# that, we can enable libc.so for the wasi-threads build.
635636
ifneq ($(THREAD_MODEL), posix)
636-
LIBC_SO = $(SYSROOT_LIB)/libc.so
637+
LIBC_SO = \
638+
$(SYSROOT_LIB)/libc.so \
639+
$(SYSROOT_LIB)/libwasi-emulated-mman.so \
640+
$(SYSROOT_LIB)/libwasi-emulated-process-clocks.so \
641+
$(SYSROOT_LIB)/libwasi-emulated-getpid.so \
642+
$(SYSROOT_LIB)/libwasi-emulated-signal.so
637643
endif
638644

639645
libc_so: include_dirs $(LIBC_SO)

libc-top-half/musl/src/internal/locale_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern hidden const struct __locale_struct __c_dot_utf8_locale;
2828
hidden const struct __locale_map *__get_locale(int, const char *);
2929
hidden const char *__mo_lookup(const void *, size_t, const char *);
3030
hidden const char *__lctrans(const char *, const struct __locale_map *);
31-
hidden const char *__lctrans_cur(const char *);
31+
const char *__lctrans_cur(const char *);
3232
hidden const char *__lctrans_impl(const char *, const struct __locale_map *);
3333
hidden int __loc_is_allocated(locale_t);
3434
hidden char *__gettextdomain(void);

0 commit comments

Comments
 (0)