Conversation
When cross-building libseccomp, build_libseccomp resets CFLAGS to an empty value (if it was unset) before each architecture, and set_cross_vars exports it. Autoconf only applies its default CFLAGS (-g -O2) when CFLAGS is unset, so the per-architecture libseccomp builds (which are what release binaries link against, including for the native architecture) end up unoptimized. The only reason CFLAGS was touched at all is that set_cross_vars puts -m32 -march=... there for 386, which is why callers had to save and restore it. Pass these flags via CC instead (as autoconf documentation suggests for multilib builds), so set_cross_vars no longer modifies CFLAGS, and remove the now-unneeded save/restore dance from both build-seccomp.sh and release_build.sh. This way, a user-provided CFLAGS is passed as is, and if it is unset, configure uses its defaults for all architectures, including 386. Note that go build does not use CFLAGS (cgo uses CGO_CFLAGS), and it handles CC with arguments just fine. Reported-by: Ciprian Hacman <ciprian@hakman.dev> (cherry picked from commit 6bcc532) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Member
|
Marking as a draft as #5464 is not merged. |
AkihiroSuda
marked this pull request as draft
September 17, 2026 14:04
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.
Backport of #5464 to release-1.5. Original description follows.
This is an alternative to #5456.
When cross-building libseccomp,
build_libseccompresetsCFLAGSto an empty value (if it was unset) before each architecture, andset_cross_varsexports it. Autoconf only applies its defaultCFLAGS(-g -O2) whenCFLAGSis unset, so the per-architecture libseccomp builds (which release binaries link against, including for the native architecture) end up unoptimized. See #5456 for performance numbers.The only reason
CFLAGSwas touched at all is thatset_cross_varsputs-m32 -march=...there for 386, which is why callers had to save and restore it. Pass these flags viaCCinstead (as autoconf documentation suggests for multilib builds), soset_cross_varsno longer modifiesCFLAGS, and remove the now-unneeded save/restore from bothbuild-seccomp.shandrelease_build.sh.This way, a user-provided
CFLAGSis passed as is, and if it is unset, configure uses its defaults for all architectures, including 386 (which #5456 does not fix, sinceset_cross_varsmakesCFLAGSnon-empty there).Tested libseccomp 2.6.0 configure (on Debian trixie) with the new
set_cross_vars:CC='x86_64-linux-gnu-gcc -m32 -march=i686',CFLAGS='-g -O2';CC='x86_64-linux-gnu-gcc',CFLAGS='-g -O2'.