diff --git a/.github/actions/rust/action.yml b/.github/actions/rust/action.yml index c2f1eff9e5..97718b393d 100644 --- a/.github/actions/rust/action.yml +++ b/.github/actions/rust/action.yml @@ -47,7 +47,6 @@ runs: if [ "$(apt-cache search --names-only '^mold$' | wc -l)" -ge 1 ]; then [ "$APT_UPDATED" ] || sudo apt-get update && echo "APT_UPDATED=1" >> "$GITHUB_ENV" sudo apt-get install -y --no-install-recommends mold - echo "RUSTFLAGS=-C link-arg=-fuse-ld=mold $RUSTFLAGS" >> "$GITHUB_ENV" fi # See https://corrode.dev/blog/tips-for-faster-ci-builds/ @@ -57,9 +56,11 @@ runs: { echo "CARGO_PROFILE_RELEASE_LTO=true" echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1" - if [ "${{ runner.os }}" == "Windows"]; then - echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld $RUSTFLAGS" - fi + if [[ "${{ runner.os }}" == "Linux" && "$(command -v mold)" ]]; then + echo "RUSTFLAGS=-C linker=clang -C link-arg=-fuse-ld=mold $RUSTFLAGS" + elif [[ "${{ runner.os }}" == "Windows" ]]; then + echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld $RUSTFLAGS" + fi } >> "$GITHUB_ENV" - name: Enable sscache diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 40ebbbb86d..d73ab48ab5 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -12,7 +12,7 @@ env: PERF_OPT: record -F997 --call-graph fp -g SCCACHE_CACHE_SIZE: 128G SCCACHE_DIRECT: true - MTU: 1504 + MTU: 1504 # https://github.com/microsoft/msquic/issues/4618 permissions: contents: read @@ -52,8 +52,6 @@ jobs: - name: Set PATH and environment run: | echo "/home/bench/.cargo/bin" >> "${GITHUB_PATH}" - # Append to RUSTFLAGS, which may already be set by the Rust action. - echo "RUSTFLAGS=-C link-arg=-Wl,--no-rosegment, -C force-frame-pointers=yes $RUSTFLAGS" >> "$GITHUB_ENV" - name: Install Rust uses: ./.github/actions/rust @@ -75,6 +73,8 @@ jobs: - name: Build neqo run: | cargo "+$TOOLCHAIN" bench --workspace --features bench --no-run + # See https://github.com/flamegraph-rs/flamegraph for why we append to RUSTFLAGS here. + export RUSTFLAGS="-C link-arg=-Wl,--no-rosegment, -C force-frame-pointers=yes $RUSTFLAGS" cargo "+$TOOLCHAIN" build --locked --release --bin neqo-client --bin neqo-server - name: Build msquic