Repository navigation
link: embld --help prints the usage on stdout and exits 0 - #201
Merged
Merged
Conversation
`embld --help` (and `-h`) was refused as "unknown option '--help'" with
exit status 2, while the other Emb tools with a usage text answer it.
The usage text is now one function, usage(FILE *), used by --help (stdout,
exit 0) and by a bare invocation with no inputs (stderr, exit 2, as before).
The test is tests/golden/embld-help.sh. Against the code before this change
it failed with:
FAIL: --help exited 2, want 0
embld: unknown option '--help'
After it, the test passes (--help, -h, and the bare invocation are each
checked for exit status and for which stream carries the text).
Also run: make embcc embld, then tests/golden/embld-{help,merge,
defined-wins,bss-align,reloc-range,veneers}.sh with EMBLD and EMBCC set to the
built binaries. Several of them skip on this host (no llvm-readelf, clang
for riscv64, qemu-system-arm). Not run: make check, make test, make test-arm64.
This host is Darwin, not Linux.
embld-doctor.sh fails on this host with "doctor exited 0 with symbols
undefined". The same failure happens with the original tools/embld/embld.c,
so it is not caused by this change; it is not investigated here.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
teo1747
approved these changes
Nov 9, 2026
teo1747
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution, and welcome! The change and the test look great.
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.
Closes #193.
embld --helpis refused today withembld: unknown option '--help'and exit status 2. The other Emb tools that have a usage text answer it (embsim --help,embmap --help).What changes
usage(FILE *), intools/embld/embld.c.--helpand-hprint the usage on stdout and exit 0.embldwith no inputs still prints the same usage on stderr and exits 2.Test
tests/golden/embld-help.shchecks the exit status and the stream for each case, not only that the words appear.Before this change the test fails:
After it, the test passes for
--help,-hand the bare invocation.What was run
make embcc embldbuilds with-Werror.tests/golden/embld-help.shpasses.llvm-readelf, no clang for riscv64, noqemu-system-arm).make check,make test,make test-arm64. The host is macOS.tests/golden/embld-doctor.shfails on this macOS host. The same failure happens with the originaltools/embld/embld.c, so it is not caused by this change. It has not been investigated here.