Repository navigation
cmake: implement WITH_MOLD option for Mold linker support - #69711
Conversation
|
Working nicely for Crimson clusters - with and without the WITH_MOLD flag. |
I'm using gcc16, and found that After applying https://github.com/sunyuechi/ceph-ci/blob/main/fork-patches/1050-fix-mold.patch, the build succeeds. Then via vstart: --seastore OK There may still be duplicate symbols. |
I'll try to test with gcc16, and get the changes to work. |
|
@sunyuechi - I now have a running cluster build with gcc-16 and Mold. I am not using the patch you have suggested. |
|
@sunyuechi - please try now |
|
jenkins test make check arm64 |
1 similar comment
|
jenkins test make check arm64 |
|
Yeah, GCC 16 builds fine now, but |
thank you. Will try to solve. |
mkogan1
left a comment
There was a problem hiding this comment.
checked on RHEL 10.2 with source /usr/lib/gcc-toolset/15-env.source
ccache -C
rm -rf ./build
./do_cmake.sh ... -DWITH_MOLD=OFF
time (cmake --build ./build --parallel $(nproc --ignore=5) -- vstart)
17418.57s user 1089.74s system 2541% cpu 12:08.18 total
^^^^^^^^
ccache -C
rm -rf ./build
./do_cmake.sh ... -DWITH_MOLD=ON
time (cmake --build ./build --parallel $(nproc --ignore=5) -- vstart)
16951.44s user 1057.92s system 2738% cpu 10:57.70 total
^^^^^^^^
The updated version was tested with both alienstore (bluestore) and seastore. |
Mold handles several linker features differently from ld.bfd: - --exclude-libs,ALL hides .symver-aliased symbols (e.g. rados_*) even when the version script lists them as global. Detect Mold (via USING_MOLD_LINKER) and disable --exclude-libs; version scripts already control symbol visibility. - Duplicate symbols across static archives are treated as errors. Merge crimson-alien-common into crimson-alienstore as a single archive. For crimson-osd, link crimson-alienstore before crimson-common with --allow-multiple-definition so the alien thread's non-crimson definitions win (Mold picks first definition). - Python/Cython extension builds (via Distutils.cmake) invoked the system default linker. Pass -fuse-ld= via MOLD_FUSE_LD_FLAG so extensions link with the configured linker. - Add rados_* and _rados_* to librados.map global section for Mold compatibility with .symver aliases. Co-authored-by: Mark Kogan <[email protected]> Signed-off-by: Ronen Friedman <[email protected]>
Add a WITH_MOLD cmake option that auto-configures the build for the Mold linker. When enabled, cmake finds mold, sets CMAKE_LINKER, injects -fuse-ld=mold into all linker flag variables, and sets USING_MOLD_LINKER which gates the Mold-specific workarounds added in the previous commit. Usage: cmake -DWITH_MOLD=ON ... Assisted-by: Claude <claude.ai> Signed-off-by: Ronen Friedman <[email protected]>
|
@mkogan1 - can you retest the final version? |
ACK, looks good -- on latest w/ (reminder - for comparison w/ |
|
Merging based on my Teuthology runs. |
Add a WITH_MOLD cmake option that auto-configures the build for the
Mold linker. When enabled, cmake finds the mold binary, sets it as
the linker, and injects -fuse-ld= into all linker flag variables.
Some Mold-specific workarounds are dependent on the WITH_MOLD
options. These Mold-specific changes include wprkarounds for
instances where Mold handles several linker features differently
from ld.bfd:
--exclude-libs,ALL hides .symver-aliased symbols (e.g. rados_*)
even when the version script lists them as global. Detect Mold
(via USING_MOLD_LINKER) and disable --exclude-libs; version
scripts already control symbol visibility.
Duplicate symbols across static archives are treated as errors.
Merge crimson-alien-common into crimson-alienstore as a single
archive. For crimson-osd, link crimson-alienstore before
crimson-common with --allow-multiple-definition so the alien
thread's non-crimson definitions win (Mold picks first definition).
Python/Cython extension builds (via Distutils.cmake) invoked the
system default linker. Pass -fuse-ld= via MOLD_FUSE_LD_FLAG so
extensions link with the configured linker.
Some API symbols (rados_*) were not explicitly listed in
the linker version script, making them unavailable for
external linking. These were added to librados.map