Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fts build for shared library #544

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ jobs:
- os: ubuntu-latest
clang_version: 16.0.0
llvm_asset_suffix: x86_64-linux-gnu-ubuntu-18.04
enable_pic: true
- os: macos-latest
clang_version: 15.0.7
llvm_asset_suffix: x86_64-apple-darwin21.0
- os: windows-latest
clang_version: 16.0.0
enable_pic: true
steps:
- uses: actions/[email protected]
with:
Expand Down Expand Up @@ -88,12 +90,18 @@ jobs:
echo "BUILD_LIBSETJMP=no" >> $GITHUB_ENV
if: matrix.clang_version == '10.0.0'

- name: Enable PIC build for new LLVM
shell: bash
run: |
echo "MAKE_TARGETS=default libc_so" >> $GITHUB_ENV
if: matrix.enable_pic

- name: Build libc
shell: bash
run: |
make -j4 TARGET_TRIPLE=wasm32-wasi
make -j4 TARGET_TRIPLE=wasm32-wasip1
make -j4 TARGET_TRIPLE=wasm32-wasip2 WASI_SNAPSHOT=p2
kateinoigakukun marked this conversation as resolved.
Show resolved Hide resolved
make -j4 TARGET_TRIPLE=wasm32-wasi $MAKE_TARGETS
make -j4 TARGET_TRIPLE=wasm32-wasip1 $MAKE_TARGETS
make -j4 TARGET_TRIPLE=wasm32-wasip2 WASI_SNAPSHOT=p2 $MAKE_TARGETS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to be passing these $MAKE_TARGETS to the threaded builds a couple of lines below as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like THREAD_MODEL=posix does not support PIC build for now

# TODO: As of this writing, wasi_thread_start.s uses non-position-independent


- name: Build libc + threads
# Only build the thread-capable wasi-libc in the latest supported Clang
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ BULK_MEMORY_SO_OBJS = $(patsubst %.o,%.pic.o,$(BULK_MEMORY_OBJS))
DLMALLOC_SO_OBJS = $(patsubst %.o,%.pic.o,$(DLMALLOC_OBJS))
LIBC_BOTTOM_HALF_ALL_SO_OBJS = $(patsubst %.o,%.pic.o,$(LIBC_BOTTOM_HALF_ALL_OBJS))
LIBC_TOP_HALF_ALL_SO_OBJS = $(patsubst %.o,%.pic.o,$(LIBC_TOP_HALF_ALL_OBJS))
FTS_SO_OBJS = $(patsubst %.o,%.pic.o,$(FTS_OBJS))

PIC_OBJS = \
$(LIBC_SO_OBJS) \
Expand All @@ -635,7 +636,8 @@ PIC_OBJS = \
$(DLMALLOC_SO_OBJS) \
$(LIBC_BOTTOM_HALF_ALL_SO_OBJS) \
$(LIBC_TOP_HALF_ALL_SO_OBJS) \
$(LIBC_BOTTOM_HALF_CRT_OBJS)
$(LIBC_BOTTOM_HALF_CRT_OBJS) \
$(FTS_SO_OBJS)

# TODO: Specify SDK version, e.g. libc.so.wasi-sdk-21, as SO_NAME once `wasm-ld`
# supports it.
Expand Down Expand Up @@ -787,7 +789,7 @@ $(LIBC_TOP_HALF_ALL_OBJS) $(LIBC_TOP_HALF_ALL_SO_OBJS) $(MUSL_PRINTSCAN_LONG_DOU
-Wno-dangling-else \
-Wno-unknown-pragmas

$(FTS_OBJS): CFLAGS += \
$(FTS_OBJS) $(FTS_SO_OBJS): CFLAGS += \
-I$(MUSL_FTS_SRC_DIR) \
-I$(FTS_SRC_DIR) # for config.h

Expand Down