build: stop passing loader_options.ld twice to the linker#1409
Open
gburd wants to merge 1 commit into
Open
Conversation
loader.ld already pulls in loader_options.ld via INCLUDE, but the
loader.elf and zfs_builder.elf link rules also list loader_options.ld as
a prerequisite, so the $(patsubst %.ld,-T %.ld,$^) turns it into a second
-T loader_options.ld on the ld command line. binutils 2.46 rejects a
linker script that is included more than once ("loader_options.ld appears
multiple times"), breaking the build.
Filter loader_options.ld out of the -T patsubst input while keeping it as
a prerequisite (so a change to its contents still forces a relink). The
INCLUDE inside loader.ld resolves it via the existing -L search path.
Verified: loader.elf and zfs_builder.elf both link cleanly under
binutils 2.46 with the aws driver profile.
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.
Summary
arch/x64/loader.ldincludesloader_options.ldwith anINCLUDEdirective (added in 0b8eb87). The
loader.elfandzfs_builder.elflink rules also list
$(loader_options_dep)as a prerequisite, and thelink line runs
$(patsubst %.ld,-T %.ld,$^)over the whole prerequisitelist, so
loader_options.ldis also passed as-T loader_options.ldon the
ldcommand line.Older binutils tolerated the same linker script being pulled in twice.
binutils 2.46 does not — it errors with:
which breaks the build on any toolchain shipping binutils >= 2.46.
Fix
Filter
loader_options.ldout of the-Tpatsubst input in both linkrules, while keeping it as a prerequisite so a change to its generated
contents (
APP_LOCAL_EXEC_TLS_SIZE) still forces a relink. TheINCLUDEinside
loader.ldcontinues to resolve it via the existing-L$(out)/arch/$(arch)search path, so nothing is lost.Test plan
make build/release.x64/loader.elflinks cleanly under binutils 2.46 (previously failed with "appears multiple times")make build/release.x64/zfs_builder.elflinks cleanly under binutils 2.46-T