diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d13dd6b0..1ec64037 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -44,54 +44,54 @@ jobs: fail-fast: false matrix: include: - - target: aarch64-apple-darwin - os: macos-15 - - target: aarch64-unknown-linux-gnu - os: ubuntu-24.04-arm - - target: aarch64-pc-windows-msvc - os: windows-2025 - test_verbatim: 1 - build_only: 1 - - target: arm-unknown-linux-gnueabi - os: ubuntu-24.04 - - target: arm-unknown-linux-gnueabihf - os: ubuntu-24.04 - - target: armv7-unknown-linux-gnueabihf - os: ubuntu-24.04 - - target: i586-unknown-linux-gnu - os: ubuntu-24.04 - - target: i686-unknown-linux-gnu - os: ubuntu-24.04 - - target: loongarch64-unknown-linux-gnu - os: ubuntu-24.04 - - target: powerpc-unknown-linux-gnu - os: ubuntu-24.04 - - target: powerpc64-unknown-linux-gnu - os: ubuntu-24.04 - - target: powerpc64le-unknown-linux-gnu - os: ubuntu-24.04 - - target: riscv64gc-unknown-linux-gnu - os: ubuntu-24.04 - - target: thumbv6m-none-eabi - os: ubuntu-24.04 - - target: thumbv7em-none-eabi - os: ubuntu-24.04 - - target: thumbv7em-none-eabihf - os: ubuntu-24.04 - - target: thumbv7m-none-eabi - os: ubuntu-24.04 - - target: wasm32-unknown-unknown - os: ubuntu-24.04 - - target: x86_64-unknown-linux-gnu - os: ubuntu-24.04 - - target: x86_64-apple-darwin - os: macos-13 - - target: i686-pc-windows-msvc - os: windows-2025 - test_verbatim: 1 - - target: x86_64-pc-windows-msvc - os: windows-2025 - test_verbatim: 1 + # - target: aarch64-apple-darwin + # os: macos-15 + # - target: aarch64-unknown-linux-gnu + # os: ubuntu-24.04-arm + # - target: aarch64-pc-windows-msvc + # os: windows-2025 + # test_verbatim: 1 + # build_only: 1 + # - target: arm-unknown-linux-gnueabi + # os: ubuntu-24.04 + # - target: arm-unknown-linux-gnueabihf + # os: ubuntu-24.04 + # - target: armv7-unknown-linux-gnueabihf + # os: ubuntu-24.04 + # - target: i586-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: i686-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: loongarch64-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: powerpc-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: powerpc64-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: powerpc64le-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: riscv64gc-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: thumbv6m-none-eabi + # os: ubuntu-24.04 + # - target: thumbv7em-none-eabi + # os: ubuntu-24.04 + # - target: thumbv7em-none-eabihf + # os: ubuntu-24.04 + # - target: thumbv7m-none-eabi + # os: ubuntu-24.04 + # - target: wasm32-unknown-unknown + # os: ubuntu-24.04 + # - target: x86_64-unknown-linux-gnu + # os: ubuntu-24.04 + # - target: x86_64-apple-darwin + # os: macos-13 + # - target: i686-pc-windows-msvc + # os: windows-2025 + # test_verbatim: 1 + # - target: x86_64-pc-windows-msvc + # os: windows-2025 + # test_verbatim: 1 - target: i686-pc-windows-gnu os: windows-2025 channel: nightly-i686-gnu @@ -110,72 +110,96 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - name: Install Rust (rustup) - shell: bash - run: | - channel="nightly" - # Account for channels that have required components (MinGW) - [ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}" - rustup update "$channel" --no-self-update - rustup default "$channel" - rustup target add "${{ matrix.target }}" - rustup component add llvm-tools-preview - - uses: taiki-e/install-action@nextest - - uses: Swatinem/rust-cache@v2 - with: - key: ${{ matrix.target }} - - name: Cache Docker layers - uses: actions/cache@v4 - if: matrix.os == 'ubuntu-24.04' - with: - path: /tmp/.buildx-cache - key: ${{ matrix.target }}-buildx-${{ github.sha }} - restore-keys: ${{ matrix.target }}-buildx- - # Configure buildx to use Docker layer caching - - uses: docker/setup-buildx-action@v3 - if: matrix.os == 'ubuntu-24.04' + # - name: Install Rust (rustup) + # shell: bash + # run: | + # channel="nightly" + # # Account for channels that have required components (MinGW) + # [ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}" + # rustup update "$channel" --no-self-update + # rustup default "$channel" + # rustup target add "${{ matrix.target }}" + # rustup component add llvm-tools-preview + # - uses: taiki-e/install-action@nextest + # - uses: Swatinem/rust-cache@v2 + # with: + # key: ${{ matrix.target }} + # - name: Cache Docker layers + # uses: actions/cache@v4 + # if: matrix.os == 'ubuntu-24.04' + # with: + # path: /tmp/.buildx-cache + # key: ${{ matrix.target }}-buildx-${{ github.sha }} + # restore-keys: ${{ matrix.target }}-buildx- + # # Configure buildx to use Docker layer caching + # - uses: docker/setup-buildx-action@v3 + # if: matrix.os == 'ubuntu-24.04' - - name: Cache compiler-rt - id: cache-compiler-rt - uses: actions/cache@v4 + # - name: Cache compiler-rt + # id: cache-compiler-rt + # uses: actions/cache@v4 + # with: + # path: compiler-rt + # key: ${{ runner.os }}-compiler-rt-${{ hashFiles('ci/download-compiler-rt.sh') }} + # - name: Download compiler-rt reference sources + # if: steps.cache-compiler-rt.outputs.cache-hit != 'true' + # run: ./ci/download-compiler-rt.sh + # shell: bash + # - run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV" + # shell: bash + + # - name: Verify API list + # if: matrix.os == 'ubuntu-24.04' + # run: python3 etc/update-api-list.py --check + + - uses: msys2/setup-msys2@v2 + if: matrix.os == 'windows-2025' with: - path: compiler-rt - key: ${{ runner.os }}-compiler-rt-${{ hashFiles('ci/download-compiler-rt.sh') }} - - name: Download compiler-rt reference sources - if: steps.cache-compiler-rt.outputs.cache-hit != 'true' - run: ./ci/download-compiler-rt.sh - shell: bash - - run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV" - shell: bash + msystem: UCRT64 + update: true + install: diffutils m4 make # mingw-w64-rustup - - name: Verify API list - if: matrix.os == 'ubuntu-24.04' - run: python3 etc/update-api-list.py --check + - name: Setup windows + if: matrix.os == 'windows-2025' + shell: msys2 {0} + run: | + ./ci/run-windows.sh ${{ matrix.target }} - # Non-linux tests just use our raw script - - name: Run locally - if: matrix.os != 'ubuntu-24.04' - shell: bash - run: ./ci/run.sh ${{ matrix.target }} + - name: Run on Windows + if: matrix.os == 'windows-2025' + shell: msys2 {0} + run: | + rustc -vV + rustup show + ./ci/run.sh ${{ matrix.target }} - # Otherwise we use our docker containers to run builds - - name: Run in Docker - if: matrix.os == 'ubuntu-24.04' - run: ./ci/run-docker.sh ${{ matrix.target }} + # # Non-linux tests just use our raw script + # - name: Run locally + # if: matrix.os != 'ubuntu-24.04' + # shell: bash + # run: ./ci/run.sh ${{ matrix.target }} + + # # Otherwise we use our docker containers to run builds + # - name: Run in Docker + # if: matrix.os == 'ubuntu-24.04' + # run: ./ci/run-docker.sh ${{ matrix.target }} - name: Print test logs if available if: always() - run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi + run: | + if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi + set -x + find . -name 'config.log' -exec cat {} ';' shell: bash - # Workaround to keep Docker cache smaller - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: Move Docker cache - if: matrix.os == 'ubuntu-24.04' - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + # # Workaround to keep Docker cache smaller + # # https://github.com/docker/build-push-action/issues/252 + # # https://github.com/moby/buildkit/issues/1896 + # - name: Move Docker cache + # if: matrix.os == 'ubuntu-24.04' + # run: | + # rm -rf /tmp/.buildx-cache + # mv /tmp/.buildx-cache-new /tmp/.buildx-cache clippy: name: Clippy @@ -194,143 +218,143 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: cargo clippy --workspace --all-targets - benchmarks: - name: Benchmarks - runs-on: ubuntu-24.04 - timeout-minutes: 20 - steps: - - uses: actions/checkout@master - with: - submodules: true - - uses: taiki-e/install-action@cargo-binstall + # benchmarks: + # name: Benchmarks + # runs-on: ubuntu-24.04 + # timeout-minutes: 20 + # steps: + # - uses: actions/checkout@master + # with: + # submodules: true + # - uses: taiki-e/install-action@cargo-binstall - - name: Set up dependencies - run: | - sudo apt-get update - sudo apt-get install -y valgrind gdb libc6-dbg # Needed for iai-callgrind - rustup update "$BENCHMARK_RUSTC" --no-self-update - rustup default "$BENCHMARK_RUSTC" - # Install the version of iai-callgrind-runner that is specified in Cargo.toml - iai_version="$(cargo metadata --format-version=1 --features icount | - jq -r '.packages[] | select(.name == "iai-callgrind").version')" - cargo binstall -y iai-callgrind-runner --version "$iai_version" - sudo apt-get install valgrind - - uses: Swatinem/rust-cache@v2 + # - name: Set up dependencies + # run: | + # sudo apt-get update + # sudo apt-get install -y valgrind gdb libc6-dbg # Needed for iai-callgrind + # rustup update "$BENCHMARK_RUSTC" --no-self-update + # rustup default "$BENCHMARK_RUSTC" + # # Install the version of iai-callgrind-runner that is specified in Cargo.toml + # iai_version="$(cargo metadata --format-version=1 --features icount | + # jq -r '.packages[] | select(.name == "iai-callgrind").version')" + # cargo binstall -y iai-callgrind-runner --version "$iai_version" + # sudo apt-get install valgrind + # - uses: Swatinem/rust-cache@v2 - - name: Run icount benchmarks - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.pull_request.number }} - run: ./ci/bench-icount.sh + # - name: Run icount benchmarks + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # PR_NUMBER: ${{ github.event.pull_request.number }} + # run: ./ci/bench-icount.sh - - name: Upload the benchmark baseline - uses: actions/upload-artifact@v4 - with: - name: ${{ env.BASELINE_NAME }} - path: ${{ env.BASELINE_NAME }}.tar.xz + # - name: Upload the benchmark baseline + # uses: actions/upload-artifact@v4 + # with: + # name: ${{ env.BASELINE_NAME }} + # path: ${{ env.BASELINE_NAME }}.tar.xz - - name: Run wall time benchmarks - run: | - # Always use the same seed for benchmarks. Ideally we should switch to a - # non-random generator. - export LIBM_SEED=benchesbenchesbenchesbencheswoo! - cargo bench --package libm-test \ - --no-default-features \ - --features short-benchmarks,build-musl,libm/force-soft-floats + # - name: Run wall time benchmarks + # run: | + # # Always use the same seed for benchmarks. Ideally we should switch to a + # # non-random generator. + # export LIBM_SEED=benchesbenchesbenchesbencheswoo! + # cargo bench --package libm-test \ + # --no-default-features \ + # --features short-benchmarks,build-musl,libm/force-soft-floats - - name: Print test logs if available - if: always() - run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi - shell: bash + # - name: Print test logs if available + # if: always() + # run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi + # shell: bash - miri: - name: Miri - runs-on: ubuntu-24.04 - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Install Rust (rustup) - run: rustup update nightly --no-self-update && rustup default nightly - shell: bash - - run: rustup component add miri - - run: cargo miri setup - - uses: Swatinem/rust-cache@v2 - - run: ./ci/miri.sh + # miri: + # name: Miri + # runs-on: ubuntu-24.04 + # timeout-minutes: 10 + # steps: + # - uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Install Rust (rustup) + # run: rustup update nightly --no-self-update && rustup default nightly + # shell: bash + # - run: rustup component add miri + # - run: cargo miri setup + # - uses: Swatinem/rust-cache@v2 + # - run: ./ci/miri.sh - msrv: - name: Check libm MSRV - runs-on: ubuntu-24.04 - timeout-minutes: 10 - env: - RUSTFLAGS: # No need to check warnings on old MSRV, unset `-Dwarnings` - steps: - - uses: actions/checkout@master - - name: Install Rust - run: | - msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' libm/Cargo.toml)" - echo "MSRV: $msrv" - rustup update "$msrv" --no-self-update && rustup default "$msrv" - - uses: Swatinem/rust-cache@v2 - - run: | - # FIXME(msrv): Remove the workspace Cargo.toml so 1.63 cargo doesn't see - # `edition = "2024"` and get spooked. - rm Cargo.toml - cargo build --manifest-path libm/Cargo.toml + # msrv: + # name: Check libm MSRV + # runs-on: ubuntu-24.04 + # timeout-minutes: 10 + # env: + # RUSTFLAGS: # No need to check warnings on old MSRV, unset `-Dwarnings` + # steps: + # - uses: actions/checkout@master + # - name: Install Rust + # run: | + # msrv="$(perl -ne 'print if s/rust-version\s*=\s*"(.*)"/\1/g' libm/Cargo.toml)" + # echo "MSRV: $msrv" + # rustup update "$msrv" --no-self-update && rustup default "$msrv" + # - uses: Swatinem/rust-cache@v2 + # - run: | + # # FIXME(msrv): Remove the workspace Cargo.toml so 1.63 cargo doesn't see + # # `edition = "2024"` and get spooked. + # rm Cargo.toml + # cargo build --manifest-path libm/Cargo.toml - rustfmt: - name: Rustfmt - runs-on: ubuntu-24.04 - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Install stable `rustfmt` - run: rustup set profile minimal && rustup default stable && rustup component add rustfmt - - run: cargo fmt -- --check + # rustfmt: + # name: Rustfmt + # runs-on: ubuntu-24.04 + # timeout-minutes: 10 + # steps: + # - uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Install stable `rustfmt` + # run: rustup set profile minimal && rustup default stable && rustup component add rustfmt + # - run: cargo fmt -- --check - extensive: - name: Extensive tests for ${{ matrix.ty }} - needs: - # Wait on `clippy` so we have some confidence that the crate will build - - clippy - - calculate_vars - runs-on: ubuntu-24.04 - timeout-minutes: 240 # 4 hours - strategy: - matrix: - # Use the output from `calculate_vars` to create the matrix - # FIXME: it would be better to run all jobs (i.e. all types) but mark those that - # didn't change as skipped, rather than completely excluding the job. However, - # this is not currently possible https://github.com/actions/runner/issues/1985. - include: ${{ fromJSON(needs.calculate_vars.outputs.extensive_matrix).extensive_matrix }} - env: - TO_TEST: ${{ matrix.to_test }} - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Install Rust - run: | - rustup update nightly --no-self-update - rustup default nightly - - uses: Swatinem/rust-cache@v2 - - name: Run extensive tests - run: ./ci/run-extensive.sh - - name: Print test logs if available - run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi - shell: bash + # extensive: + # name: Extensive tests for ${{ matrix.ty }} + # needs: + # # Wait on `clippy` so we have some confidence that the crate will build + # - clippy + # - calculate_vars + # runs-on: ubuntu-24.04 + # timeout-minutes: 240 # 4 hours + # strategy: + # matrix: + # # Use the output from `calculate_vars` to create the matrix + # # FIXME: it would be better to run all jobs (i.e. all types) but mark those that + # # didn't change as skipped, rather than completely excluding the job. However, + # # this is not currently possible https://github.com/actions/runner/issues/1985. + # include: ${{ fromJSON(needs.calculate_vars.outputs.extensive_matrix).extensive_matrix }} + # env: + # TO_TEST: ${{ matrix.to_test }} + # steps: + # - uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Install Rust + # run: | + # rustup update nightly --no-self-update + # rustup default nightly + # - uses: Swatinem/rust-cache@v2 + # - name: Run extensive tests + # run: ./ci/run-extensive.sh + # - name: Print test logs if available + # run: if [ -f "target/test-log.txt" ]; then cat target/test-log.txt; fi + # shell: bash success: needs: - - benchmarks + # - benchmarks - clippy - - extensive - - miri - - msrv - - rustfmt + # - extensive + # - miri + # - msrv + # - rustfmt - test runs-on: ubuntu-24.04 timeout-minutes: 10 diff --git a/ci/run-windows.sh b/ci/run-windows.sh new file mode 100755 index 00000000..cc8e076d --- /dev/null +++ b/ci/run-windows.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -eux + +target="$1" + +m4 --help +make --help + +echo "$PATH" + +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \ + --default-toolchain nightly-x86_64-gnu \ + --target "$target" \ + --profile minimal -y + +# Wrapper to ease managerment of environments +pacman --noconfirm -S pactoys +# Install C toolchain according to `MSYSTEM` +pacboy --noconfirm -S toolchain + +pacman --noconfirm -S mingw-w64-x86_64-toolchain + +# maybe only need mingw-w64-x86_64-gcc? + +ls ~/ +echo 'export PATH="/c/Users/$USERNAME/.cargo/bin:$PATH"' >> ~/.bash_profile + +echo "$PATH" diff --git a/ci/run.sh b/ci/run.sh index 68d13c13..683fe4cb 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -2,6 +2,10 @@ set -eux +echo PATH_DBG +echo $PATH +ls /c/Users/$USERNAME/.cargo/bin + export RUST_BACKTRACE="${RUST_BACKTRACE:-full}" export NEXTEST_STATUS_LEVEL=all @@ -25,152 +29,152 @@ if [ "${USING_CONTAINER_RUSTC:-}" = 1 ]; then rustup target add "$target" fi -# Test our implementation -if [ "${BUILD_ONLY:-}" = "1" ]; then - echo "no tests to run for build-only targets" -else - test_builtins=(cargo test --package builtins-test --no-fail-fast --target "$target") - "${test_builtins[@]}" - "${test_builtins[@]}" --release - "${test_builtins[@]}" --features c - "${test_builtins[@]}" --features c --release - "${test_builtins[@]}" --features no-asm - "${test_builtins[@]}" --features no-asm --release - "${test_builtins[@]}" --features no-f16-f128 - "${test_builtins[@]}" --features no-f16-f128 --release - "${test_builtins[@]}" --benches - "${test_builtins[@]}" --benches --release - - if [ "${TEST_VERBATIM:-}" = "1" ]; then - verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\builtins-test\\target2) - "${test_builtins[@]}" --target-dir "$verb_path" --features c - fi -fi - - -declare -a rlib_paths - -# Set the `rlib_paths` global array to a list of all compiler-builtins rlibs -update_rlib_paths() { - if [ -d /builtins-target ]; then - rlib_paths=( /builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib ) - else - rlib_paths=( target/"${target}"/debug/deps/libcompiler_builtins-*.rlib ) - fi -} - -# Remove any existing artifacts from previous tests that don't set #![compiler_builtins] -update_rlib_paths -rm -f "${rlib_paths[@]}" - -cargo build -p compiler_builtins --target "$target" -cargo build -p compiler_builtins --target "$target" --release -cargo build -p compiler_builtins --target "$target" --features c -cargo build -p compiler_builtins --target "$target" --features c --release -cargo build -p compiler_builtins --target "$target" --features no-asm -cargo build -p compiler_builtins --target "$target" --features no-asm --release -cargo build -p compiler_builtins --target "$target" --features no-f16-f128 -cargo build -p compiler_builtins --target "$target" --features no-f16-f128 --release - -PREFIX=${target//unknown-/}- -case "$target" in - armv7-*) - PREFIX=arm-linux-gnueabihf- - ;; - thumb*) - PREFIX=arm-none-eabi- - ;; - *86*-*) - PREFIX= - ;; -esac - -NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) ) -if [ "$NM" = "" ]; then - NM="${PREFIX}nm" -fi - -# i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with -# rustup run to ensure that those are in PATH. -TOOLCHAIN="$(rustup show active-toolchain | sed 's/ (default)//')" -if [[ "$TOOLCHAIN" == *i686-pc-windows-gnu ]]; then - NM="rustup run $TOOLCHAIN $NM" -fi - -# Look out for duplicated symbols when we include the compiler-rt (C) implementation -update_rlib_paths -for rlib in "${rlib_paths[@]}"; do - set +x - echo "================================================================" - echo "checking $rlib for duplicate symbols" - echo "================================================================" - set -x +# # Test our implementation +# if [ "${BUILD_ONLY:-}" = "1" ]; then +# echo "no tests to run for build-only targets" +# else +# test_builtins=(cargo test --package builtins-test --no-fail-fast --target "$target") +# "${test_builtins[@]}" +# "${test_builtins[@]}" --release +# "${test_builtins[@]}" --features c +# "${test_builtins[@]}" --features c --release +# "${test_builtins[@]}" --features no-asm +# "${test_builtins[@]}" --features no-asm --release +# "${test_builtins[@]}" --features no-f16-f128 +# "${test_builtins[@]}" --features no-f16-f128 --release +# "${test_builtins[@]}" --benches +# "${test_builtins[@]}" --benches --release + +# if [ "${TEST_VERBATIM:-}" = "1" ]; then +# verb_path=$(cmd.exe //C echo \\\\?\\%cd%\\builtins-test\\target2) +# "${test_builtins[@]}" --target-dir "$verb_path" --features c +# fi +# fi + + +# declare -a rlib_paths + +# # Set the `rlib_paths` global array to a list of all compiler-builtins rlibs +# update_rlib_paths() { +# if [ -d /builtins-target ]; then +# rlib_paths=( /builtins-target/"${target}"/debug/deps/libcompiler_builtins-*.rlib ) +# else +# rlib_paths=( target/"${target}"/debug/deps/libcompiler_builtins-*.rlib ) +# fi +# } + +# # Remove any existing artifacts from previous tests that don't set #![compiler_builtins] +# update_rlib_paths +# rm -f "${rlib_paths[@]}" + +# cargo build -p compiler_builtins --target "$target" +# cargo build -p compiler_builtins --target "$target" --release +# cargo build -p compiler_builtins --target "$target" --features c +# cargo build -p compiler_builtins --target "$target" --features c --release +# cargo build -p compiler_builtins --target "$target" --features no-asm +# cargo build -p compiler_builtins --target "$target" --features no-asm --release +# cargo build -p compiler_builtins --target "$target" --features no-f16-f128 +# cargo build -p compiler_builtins --target "$target" --features no-f16-f128 --release + +# PREFIX=${target//unknown-/}- +# case "$target" in +# armv7-*) +# PREFIX=arm-linux-gnueabihf- +# ;; +# thumb*) +# PREFIX=arm-none-eabi- +# ;; +# *86*-*) +# PREFIX= +# ;; +# esac + +# NM=$(find "$(rustc --print sysroot)" \( -name llvm-nm -o -name llvm-nm.exe \) ) +# if [ "$NM" = "" ]; then +# NM="${PREFIX}nm" +# fi + +# # i686-pc-windows-gnu tools have a dependency on some DLLs, so run it with +# # rustup run to ensure that those are in PATH. +# TOOLCHAIN="$(rustup show active-toolchain | sed 's/ (default)//')" +# if [[ "$TOOLCHAIN" == *i686-pc-windows-gnu ]]; then +# NM="rustup run $TOOLCHAIN $NM" +# fi + +# # Look out for duplicated symbols when we include the compiler-rt (C) implementation +# update_rlib_paths +# for rlib in "${rlib_paths[@]}"; do +# set +x +# echo "================================================================" +# echo "checking $rlib for duplicate symbols" +# echo "================================================================" +# set -x - duplicates_found=0 - - # NOTE On i586, It's normal that the get_pc_thunk symbol appears several - # times so ignore it - $NM -g --defined-only "$rlib" 2>&1 | - sort | - uniq -d | - grep -v __x86.get_pc_thunk --quiet | - grep 'T __' && duplicates_found=1 - - if [ "$duplicates_found" != 0 ]; then - echo "error: found duplicate symbols" - exit 1 - else - echo "success; no duplicate symbols found" - fi -done - -rm -f "${rlib_paths[@]}" - -build_intrinsics_test() { - cargo build \ - --target "$target" --verbose \ - --manifest-path builtins-test-intrinsics/Cargo.toml "$@" -} - -# Verify that we haven't dropped any intrinsics/symbols -build_intrinsics_test -build_intrinsics_test --release -build_intrinsics_test --features c -build_intrinsics_test --features c --release - -# Verify that there are no undefined symbols to `panic` within our -# implementations -CARGO_PROFILE_DEV_LTO=true build_intrinsics_test -CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release - -# Ensure no references to any symbols from core -update_rlib_paths -for rlib in "${rlib_paths[@]}"; do - set +x - echo "================================================================" - echo "checking $rlib for references to core" - echo "================================================================" - set -x - - tmpdir="${CARGO_TARGET_DIR:-target}/tmp" - test -d "$tmpdir" || mkdir "$tmpdir" - defined="$tmpdir/defined_symbols.txt" - undefined="$tmpdir/defined_symbols.txt" - - $NM --quiet -U "$rlib" | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > "$defined" - $NM --quiet -u "$rlib" | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > "$undefined" - grep_has_results=0 - grep -v -F -x -f "$defined" "$undefined" && grep_has_results=1 - - if [ "$target" = "powerpc64-unknown-linux-gnu" ]; then - echo "FIXME: powerpc64 fails these tests" - elif [ "$grep_has_results" != 0 ]; then - echo "error: found unexpected references to core" - exit 1 - else - echo "success; no references to core found" - fi -done +# duplicates_found=0 + +# # NOTE On i586, It's normal that the get_pc_thunk symbol appears several +# # times so ignore it +# $NM -g --defined-only "$rlib" 2>&1 | +# sort | +# uniq -d | +# grep -v __x86.get_pc_thunk --quiet | +# grep 'T __' && duplicates_found=1 + +# if [ "$duplicates_found" != 0 ]; then +# echo "error: found duplicate symbols" +# exit 1 +# else +# echo "success; no duplicate symbols found" +# fi +# done + +# rm -f "${rlib_paths[@]}" + +# build_intrinsics_test() { +# cargo build \ +# --target "$target" --verbose \ +# --manifest-path builtins-test-intrinsics/Cargo.toml "$@" +# } + +# # Verify that we haven't dropped any intrinsics/symbols +# build_intrinsics_test +# build_intrinsics_test --release +# build_intrinsics_test --features c +# build_intrinsics_test --features c --release + +# # Verify that there are no undefined symbols to `panic` within our +# # implementations +# CARGO_PROFILE_DEV_LTO=true build_intrinsics_test +# CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release + +# # Ensure no references to any symbols from core +# update_rlib_paths +# for rlib in "${rlib_paths[@]}"; do +# set +x +# echo "================================================================" +# echo "checking $rlib for references to core" +# echo "================================================================" +# set -x + +# tmpdir="${CARGO_TARGET_DIR:-target}/tmp" +# test -d "$tmpdir" || mkdir "$tmpdir" +# defined="$tmpdir/defined_symbols.txt" +# undefined="$tmpdir/defined_symbols.txt" + +# $NM --quiet -U "$rlib" | grep 'T _ZN4core' | awk '{print $3}' | sort | uniq > "$defined" +# $NM --quiet -u "$rlib" | grep 'U _ZN4core' | awk '{print $2}' | sort | uniq > "$undefined" +# grep_has_results=0 +# grep -v -F -x -f "$defined" "$undefined" && grep_has_results=1 + +# if [ "$target" = "powerpc64-unknown-linux-gnu" ]; then +# echo "FIXME: powerpc64 fails these tests" +# elif [ "$grep_has_results" != 0 ]; then +# echo "error: found unexpected references to core" +# exit 1 +# else +# echo "success; no references to core found" +# fi +# done # Test libm @@ -218,9 +222,9 @@ esac case "$target" in # MSVC cannot link MPFR *windows-msvc*) ;; - # FIXME: MinGW should be able to build MPFR, but setup in CI is nontrivial. - *windows-gnu*) ;; # Targets that aren't cross compiled in CI work fine + i686-pc-windows-gnu) mflags+=(--features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross) ;; + *windows-gnu*) mflags+=(--features libm-test/build-mpfr) ;; aarch64*apple*) mflags+=(--features libm-test/build-mpfr) ;; aarch64*linux*) mflags+=(--features libm-test/build-mpfr) ;; i586*) mflags+=(--features libm-test/build-mpfr --features gmp-mpfr-sys/force-cross) ;; diff --git a/libm/Cargo.toml b/libm/Cargo.toml index f80715ff..521c745a 100644 --- a/libm/Cargo.toml +++ b/libm/Cargo.toml @@ -47,3 +47,5 @@ unexpected_cfgs = { level = "warn", check-cfg = [ # compiler-builtins sets this feature, but we use it in `libm` 'cfg(feature, values("compiler-builtins"))', ] } + +# TODO drop this line, it's just to poke CI that runs on libm changes