From b37cc3806befb38500151f658c5390124584cfa7 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Sun, 9 Feb 2025 16:42:54 +0200 Subject: [PATCH] Stop using mold linker There isn't anything wrong with with 'mold' as such, but it also doesn't give any benefit. Better to stick to the defaults when there's no reason to deviate. 'mold' might be a little faster, but it's insignificant when doing a full build. It might make a difference when doing an incremental build, but docker builds are not incremental. I didn't remove 'mold' from the build-tools image yet, as I'm not sure if the image might still be used to build old images that are still using 'mold', or perhaps to build PRs created earlier. I will remove 'mold' from build-tools later as a separate PR, after some time has passed. --- .github/workflows/_build-and-test-locally.yml | 14 +++++++------- Dockerfile | 4 ++-- compute/compute-node.Dockerfile | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/_build-and-test-locally.yml b/.github/workflows/_build-and-test-locally.yml index a963452523..cb65e4c067 100644 --- a/.github/workflows/_build-and-test-locally.yml +++ b/.github/workflows/_build-and-test-locally.yml @@ -145,32 +145,32 @@ jobs: - name: Build postgres v14 if: steps.cache_pg_14.outputs.cache-hit != 'true' - run: mold -run make ${make_vars} postgres-v14 -j$(nproc) + run: make ${make_vars} postgres-v14 -j$(nproc) - name: Build postgres v15 if: steps.cache_pg_15.outputs.cache-hit != 'true' - run: mold -run make ${make_vars} postgres-v15 -j$(nproc) + run: make ${make_vars} postgres-v15 -j$(nproc) - name: Build postgres v16 if: steps.cache_pg_16.outputs.cache-hit != 'true' - run: mold -run make ${make_vars} postgres-v16 -j$(nproc) + run: make ${make_vars} postgres-v16 -j$(nproc) - name: Build postgres v17 if: steps.cache_pg_17.outputs.cache-hit != 'true' - run: mold -run make ${make_vars} postgres-v17 -j$(nproc) + run: make ${make_vars} postgres-v17 -j$(nproc) - name: Build neon extensions - run: mold -run make ${make_vars} neon-pg-ext -j$(nproc) + run: make ${make_vars} neon-pg-ext -j$(nproc) - name: Build walproposer-lib - run: mold -run make ${make_vars} walproposer-lib -j$(nproc) + run: make ${make_vars} walproposer-lib -j$(nproc) - name: Run cargo build env: WITH_TESTS: ${{ matrix.sanitizers != 'enabled' && '--tests' || '' }} run: | export ASAN_OPTIONS=detect_leaks=0 - ${cov_prefix} mold -run cargo build $CARGO_FLAGS $CARGO_FEATURES --bins ${WITH_TESTS} + ${cov_prefix} cargo build $CARGO_FLAGS $CARGO_FEATURES --bins ${WITH_TESTS} # Do install *before* running rust tests because they might recompile the # binaries with different features/flags. diff --git a/Dockerfile b/Dockerfile index 7ba54c8ca5..e8e0003750 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ COPY --chown=nonroot scripts/ninstall.sh scripts/ninstall.sh ENV BUILD_TYPE=release RUN set -e \ - && mold -run make -j $(nproc) -s neon-pg-ext \ + && make -j $(nproc) -s neon-pg-ext \ && rm -rf pg_install/build \ && tar -C pg_install -czf /home/nonroot/postgres_install.tar.gz . @@ -45,7 +45,7 @@ COPY --chown=nonroot . . ARG ADDITIONAL_RUSTFLAGS RUN set -e \ - && RUSTFLAGS="-Clinker=clang -Clink-arg=-fuse-ld=mold -Clink-arg=-Wl,--no-rosegment -Cforce-frame-pointers=yes ${ADDITIONAL_RUSTFLAGS}" cargo build \ + && RUSTFLAGS="-Clink-arg=-Wl,--no-rosegment -Cforce-frame-pointers=yes ${ADDITIONAL_RUSTFLAGS}" cargo build \ --bin pg_sni_router \ --bin pageserver \ --bin pagectl \ diff --git a/compute/compute-node.Dockerfile b/compute/compute-node.Dockerfile index 43910f2622..aa052dc2fb 100644 --- a/compute/compute-node.Dockerfile +++ b/compute/compute-node.Dockerfile @@ -1578,7 +1578,7 @@ ENV BUILD_TAG=$BUILD_TAG USER nonroot # Copy entire project to get Cargo.* files with proper dependencies for the whole project COPY --chown=nonroot . . -RUN mold -run cargo build --locked --profile release-line-debug-size-lto --bin compute_ctl --bin fast_import --bin local_proxy +RUN cargo build --locked --profile release-line-debug-size-lto --bin compute_ctl --bin fast_import --bin local_proxy ######################################################################################### #