Skip to content

Commit f084e74

Browse files
committed
tpm2-tools: packaging-time -O normalization; mark as fixed in OFLAG inventory (validated x86)
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent ce338e7 commit f084e74

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

build_OFLAG_inventory.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pixman,,OK - no -O2/-O3, ,build/x86/log/pixman.log
6363
powerpc-utils,,OK - no -O2/-O3, ,build/ppc64/log/powerpc-utils.log
6464
purism-blobs,,N/A - binary blobs, ,
6565
qrencode,,OK - explicitly set -Oz, ,build/x86/log/qrencode.log
66-
tpm2-tools,,CONFIRMED - hardcoded -O2 (3 occurrences across logs), ,build/x86/log/tpm2-tools.log
66+
tpm2-tools,x86,fixed - pre-configure sed applied; validated V=1 (x86); commit TBD,"... -g -Oz -MT tools/tpm2-tpm2_tpm2.o ...","build/x86/log/tpm2-tools.log"
6767
u-root,,UNKNOWN - no logs, ,
6868
util-linux,,OK - no -O2/-O3, ,build/x86/log/util-linux.log
6969
zstd,,OK - no -O2/-O3, ,build/x86/log/zstd.log

doc/OFLAG_fixes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ This document lists recent OFLAG (optimization flag) fixes applied in the reposi
3737
- Validation: V=1 builds completed for x86 & ppc64 and grep shows no remaining -O3 in build trees
3838
- Logs: build/x86/log/tpmtotp.log, build/ppc64/log/tpmtotp.log
3939

40+
- tpm2-tools
41+
- Fix: pre-configure sed normalizes `-O[0-9]+`/`-Os` -> `-Oz` and `CFLAGS`/`CXXFLAGS` set to `-g -Oz` defensively in `modules/tpm2-tools`.
42+
- Validation: V=1 x86 build (board `msi_z790p_ddr5`) completed successfully and compile/link lines show `-Oz` only; configure-wrapper occurrences were addressed. TODO: run ppc64 validation if relevant.
43+
- Logs: build/x86/log/tpm2-tools.log, build/x86/tpm2-tools-5.6/config.log
44+
4045
- dropbear
4146
- Fix: packaging-time sed normalizes optimization flags to `-Oz` (replaces `-O[0-9]+` & `-Os` with `-Oz`) and configure is invoked with size-friendly env vars where applicable. We intentionally do not strip `-funroll-loops`/`-fomit-frame-pointer` at packaging time because reintroducing them into bundled libs did not change final binary sizes in our tests.
4247
- Validation: V=1 x86 build shows `-Oz` in `configure` and build logs. However, a size regression was observed versus the earlier CircleCI artifact: `dropbear` 184,832 → 241,248 (+56,416 bytes), `ssh` 176,416 → 233,048 (+56,632 bytes). Local builds used GCC 15.1.0 while the earlier artifact used GCC 9.4.0; most likely root cause is compiler/toolchain or upstream package-version changes rather than residual `-O` flags.

modules/tpm2-tools

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@ tpm2-tools_hash := 52c8bcbaadca082abfe5eb7ee4967d2d632d84b1677675f2f071b6d2ec22c
2727
# We pass additional remapping of prefix-map from $INSTALL to local dir
2828
#
2929
# TODO: remove all patches and uniformize with similar sed calls.
30+
# # normalize any -O[0-9]+ / -Os tokens introduced by upstream or patches \
31+
# and remove any stray Makefile backups; set defensive CFLAGS/CXXFLAGS \
32+
3033
tpm2-tools_configure := \
3134
echo "$(tpm2-tools_version)" > ./VERSION \
3235
&& ./bootstrap \
3336
&& sed -i 's/hardcode_libdir_flag_spec=.*/hardcode_libdir_flag_spec=" "/' configure \
34-
&& ./configure \
37+
&& sed -E -i 's/-O[0-9]+/-Oz/g; s/-Os/-Oz/g' configure \
38+
&& rm -f Makefile*bak* || true \
39+
&& CFLAGS="-g -Oz" CXXFLAGS="-g -Oz" ./configure \
3540
$(CROSS_TOOLS) \
3641
--host $(MUSL_ARCH)-elf-linux \
3742
--prefix "/" \

0 commit comments

Comments
 (0)