Skip to content

Commit

Permalink
Merge pull request #566 from trevyn/wasm
Browse files Browse the repository at this point in the history
build: Allow building C compiler-rt fallbacks for wasm
  • Loading branch information
Amanieu authored Jan 30, 2024
2 parents 32cb975 + a7cc0f6 commit 1d96ebb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ jobs:
- run: rustup component add llvm-tools-preview
- name: Download compiler-rt reference sources
run: |
curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/12.0-2021-04-15.tar.gz
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-12.0-2021-04-15/compiler-rt
curl -L -o code.tar.gz https://github.com/rust-lang/llvm-project/archive/rustc/13.0-2021-08-08.tar.gz
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-13.0-2021-08-08/compiler-rt
echo RUST_COMPILER_RT_ROOT=./compiler-rt >> $GITHUB_ENV
shell: bash

Expand Down
4 changes: 1 addition & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ fn main() {
if !cfg!(feature = "mangled-names") && cfg!(feature = "c") {
// Don't use a C compiler for these targets:
//
// * wasm - clang for wasm is somewhat hard to come by and it's
// unlikely that the C is really that much better than our own Rust.
// * nvptx - everything is bitcode, not compatible with mixed C/Rust
if !target.contains("wasm") && !target.contains("nvptx") {
if !target.contains("nvptx") {
#[cfg(feature = "c")]
c::compile(&llvm_target, &target);
}
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/wasm32-unknown-unknown/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:20.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates
gcc clang libc6-dev ca-certificates

ENV CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=true
1 change: 1 addition & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ for rlib in $(echo $path); do
grep -v __x86.get_pc_thunk | \
grep -v __builtin_cl | \
grep -v __builtin_ctz | \
grep -v __builtin_sadd_overflow | \
grep 'T __'

if test $? = 0; then
Expand Down

0 comments on commit 1d96ebb

Please sign in to comment.