Skip to content

ci: build and test the present configuration at -O2 - #414

Merged
jwinarske merged 2 commits into
mainfrom
ci/optimized-build
Dec 3, 2026
Merged

jwinarske merged 2 commits into
mainfrom
ci/optimized-build

Conversation

@jwinarske

@jwinarske jwinarske commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Every CI build was Meson's default type, which does not optimize. A distribution builds a4l optimized (Yocto: -O2, buildtype=plain), and that build crashed in the first app library to call GetEnv until #412. Nothing in CI compiled the code that way.

Two commits:

  1. ci: the present job gains a leg that configures the same Skia, Vulkan and wcs configuration with -O2 -fstack-protector-strong and --buildtype=plain, holds the compile to the zero-warning gate, and runs the tests on it.
  2. ndk: the 11 warnings that leg found on its first run, all in src/ndk/bionic_runtime.cpp:
    • pread of an ELF's program headers was unchecked; a short read was used as if whole. It now fails the load.
    • Nine write(2) calls in the fault and crash paths go through write_stderr().
    • The locale variables are copied by length after the fit is checked, in place of an snprintf whose own check was the warning.

What it does not cover

The runner has no ART and no app, so the JNI wrappers that swap the thread pointer are compiled at -O2 here and not run. This leg catches a warning or a test failure that only an optimized build shows. It would not have caught the #412 crash; that needs a test that loads an app library, which CI cannot do today.

Test status

Check Result
New -O2 leg, first commit alone Failed the warning gate: 11 warnings
New -O2 leg, both commits (GCC 13) Compiles with no warning; tests pass
x86-64, GCC 16, the file at -O2 -D_FORTIFY_SOURCE=3 11 warnings on main, none with this
x86-64 default build, arm64 clang release build No warning
x86-64, a WebView app Loads its library, 588 frames in 22 s
x86-64 suite, default build 135 of 135 pass

_FORTIFY_SOURCE is not passed in CI: the image's GCC defines it when optimizing, and a second definition warns in every file.

Every CI build was Meson's default type, which does not optimize. A
distribution builds a4l optimized (Yocto: -O2, buildtype=plain), and
that build crashed in the first app library to call GetEnv until
83beb79. Nothing in CI compiled the code that way.

The present job gains a leg that configures the same Skia, Vulkan and
wcs configuration with -O2 -fstack-protector-strong and
buildtype=plain, holds the compile to the zero-warning gate and runs
the tests on it.

The runner has no ART and no app, so the JNI wrappers that swap the
thread pointer are compiled at -O2 here and not run. This catches a
warning or a test failure that only an optimized build shows; it would
not have caught that crash.

Tested: the workflow parses and the action-pin gate passes. The leg
itself first runs in this change's own CI.

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
The -O2 leg found 11 warnings in bionic_runtime.cpp that the default
build does not give: glibc marks pread and write warn_unused_result
only when fortified, and the truncation check needs the optimizer.

- pread of an ELF's program headers was unchecked; a short read was
  used as if whole. It now fails the load.
- Nine write(2) calls in the fault and crash paths go through
  write_stderr(), which writes all it can and has nobody to report a
  failure to.
- The locale variables are copied by length after the fit is checked,
  in place of an snprintf whose own check was the warning.

Tested:
- x86-64, GCC 16, this file at -O2 -D_FORTIFY_SOURCE=3: 11 warnings on
  main, none with this.
- x86-64 default build and the arm64 clang release build: no warning.
- x86-64, a WebView app: loads its library and draws 588 frames in
  22 s.

Signed-off-by: Joel Winarske <joel.winarske@linux.com>
@jwinarske
jwinarske merged commit 2eb53b4 into main Dec 3, 2026
11 checks passed
@jwinarske
jwinarske deleted the ci/optimized-build branch December 3, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant