Shrink binary 14-49% and add qemu-arm CI tests#4
Merged
Conversation
Source changes: - Replace sscanf with hand-parsed HTTP status code - Replace getaddrinfo with gethostbyname (IPv4-only, sufficient for target HW) - Replace strncat/strcpy/strlen chain with bufcat() — biggest win, drops 4 PLT entries - execlp → execl (absolute path, no PATH search needed) - Remove unused includes (stdio.h, stddef.h) and dead NDEBUG guard Build changes: - Add -ffunction-sections -fdata-sections + -Wl,--gc-sections for dead code elimination - Strip .eh_frame, .eh_frame_hdr, .ARM.attributes, .jcr sections Measured results (stripped, before UPX): hisiv300 uClibc: 5456 → 4688 (-14%) hisiv500 uClibc: 5464 → 4680 (-14%) hisiv510 uClibc: 5464 → 4680 (-14%) hisiv600 glibc: 5724 → 4908 (-14%) himix100 uClibc: 5268 → 4680 (-11%) himix200 glibc: 9576 → 4908 (-49%) CI: add qemu-arm functional tests (no args, bad args, HTTP GET, 404) for all 6 toolchains. Co-Authored-By: Claude Opus 4.6 (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.
Summary
Measured results (stripped, before UPX)
What changed
Source (
uget.c):sscanf→ hand-parsed HTTP status code (removes PLT entry + format string)getaddrinfo/freeaddrinfo→gethostbyname(IPv4-only, sufficient for HiSilicon targets)strncat/strcpy/strlenchain →bufcat()helper (biggest win: -4 PLT entries)execlp→execl(absolute path, no PATH search needed)Build (
Makefile):-ffunction-sections -fdata-sections+-Wl,--gc-sections.eh_frame,.eh_frame_hdr,.ARM.attributes,.jcrCI (
.github/workflows/release.yml):qemu-user, run 4 functional tests per toolchain after buildTest plan
🤖 Generated with Claude Code