Trouble building lib/liblldb.so.17.0.0 on 6.0.1 using manually built 5.10.1

Just to verify: are you trying to build specifically with lld as your linker, or is your /usr/bin/ld an alias for gold?

If your /usr/bin/ld is lld, you need to set the LLVM_USE_LINKER=lld CMake variable in the build script to have LLVM, lldb, and the rest of the components know they're building with lld (which alters some of the linking behavior).

Is this your full build invocation (minus the install location), or are there any additional flags?

If you want to use the preset approach, you can add the CMake flag by editing swift/utils/build-presets.ini to add another preset at the bottom like so:

[preset: buildbot_linux,no_test,lld]
mixin-preset=buildbot_linux,no_test
extra-cmake-options=-DLLVM_USE_LINKER=lld

The name of the preset you create doesn't matter, just that you use it when building.

For reference, this is the preset I put together for building Swift 6.0.1 on Gentoo:

(Here you can see I'm passing multiple additional CMake options to the script; most of the other flags are likely irrelevant to your situation, though I would consider basing your build off the buildbot_linux,no_assertions,no_test preset to also disable assertions.)

Happy to try to help get you set up with a build!