Linker scripts: remove malformed DISCARD block that pulled in full newlib - #715
Open
zeroisnan wants to merge 1 commit into
Open
Linker scripts: remove malformed DISCARD block that pulled in full newlib#715zeroisnan wants to merge 1 commit into
zeroisnan wants to merge 1 commit into
Conversation
…wlib Co-Authored-By: Claude Opus 5 <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.
Removes the
DISCARDblock fromcore/STM32H750IB_flash.lds,_qspi.ldsand_sram.lds.DISCARDis not/DISCARD/, so the block never discarded anything. What it did do is namelibc.a,libm.aandlibgcc.aas plain filenames, which makes GNU ld load those archives. Full newlib'slibc.atherefore entered every link. Under CMake the script is passed as-Wl,-T,...and so sits early on the linker command line, where it satisfies symbols before newlib-nano is reached; the Makefile passes-T$(LDSCRIPT), which GCC places last, so it was unaffected.Verification on
examples/SerialPrint:_impure_dataA typical stdio-using example drops 2,832 B flash and 1,304 B RAM.
Both build systems were checked across every storage layout the linker scripts serve:
DAISY_STORAGE=flash,sramandqspi, before and after. After the change none of the 105 resulting binaries links any member of fulllibc.a, and every_impure_datathat survives--gc-sectionsis newlib-nano's 76 B. All three layouts behave identically.APP_TYPE=BOOT_NONE,BOOT_SRAMandBOOT_QSPI, before and after. All 137 resulting ELFs are byte-identical, so the Makefile path is unaffected.(
examples/QSPI_EraseTimingdoes not link underAPP_TYPE=BOOT_SRAM, overflowingDTCMRAMby ~156 KB. That is pre-existing and identical before and after this change; it is excluded from the 137 above and left alone here.)Fixes #714.
🤖 Generated with Claude Code