Link linux builds with lld (bfd rejects --start-lib on 20.04) - #6
Merged
Conversation
The bfd linker on ubuntu:20.04 (binutils 2.34) rejects the --start-lib flag Bazel emits: /usr/bin/ld.bfd: unrecognized option '--start-lib' --start-lib is only supported by gold and lld. Install lld and link both linux arches with --linkopt=-fuse-ld=lld: it handles --start-lib and also sidesteps the aarch64 gold erratum-843419 crash, so one uniform linker works for x86_64 and arm64. Linker choice does not affect glibc symbol versioning, so portability is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #5. The containerized linux build got further — the glibc-2.31 container is correct and darwin built fine — but both linux legs failed at link:
Cause
PR #5 forced
--linkopt=-fuse-ld=bfd, but Bazel emits--start-lib/--end-lib, which only gold and lld support —bfddidn't gain--start-libuntil binutils 2.38, and ubuntu:20.04 ships 2.34.Fix
Install
lldand link both linux arches with--linkopt=-fuse-ld=lld. lld:--start-lib(unlike 20.04's bfd), anderratum-843419crash that bit us back in Release workflow: auto-derive version + fix linux-arm64 linker #2,so one uniform linker works for x86_64 and arm64. Linker choice doesn't change which glibc/libstdc++ symbol versions are referenced, so the glibc 2.31 portability from #5 is preserved.
Validation status (build pipeline, run 28060201258)
Head SHA
477ccdfe72— confirm before merging.🤖 Generated with Claude Code