add preview2_component_type.o to libc.a and libc.so (#472)

This file adds a custom section to each core module linked with wasi-libc.  That
custom section contains component type information needed by e.g. `wasm-tools
component new` to generate a component from the module.  It will be required
once we start using any part of WASI 0.2.0 directly (vs. via a Preview 1
adapter).  In addition, it allows developers to `#include <wasi/preview2.h>` in
their code and make use of those APIs directly even if wasi-libc is not using
them yet.

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
This commit is contained in:
Joel Dice 2024-02-22 15:09:50 -07:00 committed by GitHub
parent 55df1f54e2
commit 0fe51d2582
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -380,6 +380,9 @@ DLMALLOC_OBJS = $(call objs,$(DLMALLOC_SOURCES))
EMMALLOC_OBJS = $(call objs,$(EMMALLOC_SOURCES))
LIBC_BOTTOM_HALF_ALL_OBJS = $(call objs,$(LIBC_BOTTOM_HALF_ALL_SOURCES))
LIBC_TOP_HALF_ALL_OBJS = $(call asmobjs,$(call objs,$(LIBC_TOP_HALF_ALL_SOURCES)))
ifeq ($(WASI_SNAPSHOT), preview2)
LIBC_OBJS += $(OBJDIR)/preview2_component_type.o
endif
ifeq ($(MALLOC_IMPL),dlmalloc)
LIBC_OBJS += $(DLMALLOC_OBJS)
else ifeq ($(MALLOC_IMPL),emmalloc)
@ -601,6 +604,10 @@ $(OBJDIR)/%.long-double.pic.o: %.c include_dirs
@mkdir -p "$(@D)"
$(CC) $(CFLAGS) -MD -MP -o $@ -c $<
$(OBJDIR)/preview2_component_type.pic.o $(OBJDIR)/preview2_component_type.o: $(LIBC_BOTTOM_HALF_SOURCES)/preview2_component_type.o
@mkdir -p "$(@D)"
cp $< $@
$(OBJDIR)/%.pic.o: %.c include_dirs
@mkdir -p "$(@D)"
$(CC) $(CFLAGS) -MD -MP -o $@ -c $<

View File

@ -19,6 +19,7 @@ __c_locale
__clock
__clock_gettime
__clock_nanosleep
__component_type_object_force_link_preview2
__component_type_object_force_link_preview2_public_use_in_this_compilation_unit
__cos
__cosdf

View File

@ -1,5 +1,4 @@
__addtf3
__component_type_object_force_link_preview2
__divtf3
__eqtf2
__extenddftf2