Skip to content

Commit 7b92d2a

Browse files
committed
ci(composition): scope A1d-bind-now to release links, declare fixtures by name
Step 0o (MCPB bundle contract) and Step 0q (release candidate derivation) hand the composition gate a stub compiled straight from a .c file with the compiler's defaults. That stub exists to exercise packaging, format detection and the needle scans; it is not linked with -z now and never ships. A1d measured eager binding on it anyway, so on a toolchain that binds lazily by default (test-diag: clang-22) Step 0o died deterministically with A1d-bind-now stage/codebase-memory-mcp: GOT section(s) .got.plt fall outside PT_GNU_RELRO [15824,16384) — they stay WRITABLE after relocation The property A1d protects is a property of the release link (-z now in Makefile.cbm), so the assertion is scoped to it: a caller that feeds the gate a packaging fixture declares so with CBM_COMPOSITION_FIXTURE=1 and A1d is reported n/a — printed on every run as a named exemption, never a silent skip. Every other assertion still runs on the fixture unchanged, and release derivation never sets the variable. Verified in the Linux arm64 container (Ubuntu 24.04, gcc 13.3): a stub linked -z lazy reproduces the CI failure text on the gate without the variable and reports n/a with it; both contracts pass under a CC wrapper that links lazily (the shape that was red), and unchanged on macOS. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent fece72b commit 7b92d2a

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎scripts/ci/check-binary-composition.sh‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
# meaningful. Exit 0 = every assertion passed, 1 = at least one failed,
3030
# 2 = usage error, missing tool, or nothing checkable was found (a vacuous
3131
# run is a failure, not a pass).
32+
# CBM_COMPOSITION_FIXTURE=1 declares the target a packaging FIXTURE (a stub
33+
# compiled by a contract test, not a release link): A1d-bind-now is then
34+
# reported n/a instead of asserted, because eager binding is a property of
35+
# the release link flags, not of the packaging path the fixture exercises.
36+
# Only contract tests set it; release derivation never does.
3237
set -euo pipefail
3338

3439
case "${1:-}" in
@@ -409,7 +414,19 @@ check_file() {
409414
# writes the GOT after the loader has already re-protected it. A static
410415
# binary has no PT_DYNAMIC and nothing to bind at runtime, so GOT coverage
411416
# is the whole property there — a distinct reported outcome, never a skip.
412-
if [ "$fmt" != elf ]; then
417+
#
418+
# Scope: this is a property of the RELEASE link (-z now in Makefile.cbm).
419+
# Contract tests hand the gate a stub compiled straight from a .c file to
420+
# exercise packaging, format detection and the needle scans; a stub is not
421+
# linked with -z now and never ships, so asserting eager binding on it
422+
# tests the fixture's compiler defaults, not the artifact. Such a caller
423+
# declares itself with CBM_COMPOSITION_FIXTURE=1 and A1d is reported n/a —
424+
# a named exemption, printed on every run, never a silent skip. Every
425+
# other assertion still runs on the fixture unchanged.
426+
if [ "${CBM_COMPOSITION_FIXTURE:-0}" = 1 ]; then
427+
printf 'n/a %-22s %s: packaging fixture (CBM_COMPOSITION_FIXTURE=1) — eager binding is asserted on release links only\n' \
428+
A1d-bind-now "$token"
429+
elif [ "$fmt" != elf ]; then
413430
printf 'n/a %-22s %s: BIND_NOW is an ELF dynamic-section property\n' \
414431
A1d-bind-now "$token"
415432
elif [ "$relro_window" = unsupported ]; then

‎tests/test_mcpb_bundle_contract.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@
1414
# the SQLite OMIT_LOAD_EXTENSION marker — live in .rodata. This test packages
1515
# the same opaque selected bytes under foreign target labels deliberately; this
1616
# boundary proves it never invokes strip/codesign and never changes bytes.
17+
#
18+
# One assertion is scoped out, by name: A1d-bind-now measures eager binding,
19+
# a property of the RELEASE link (-z now in Makefile.cbm). The stub below is
20+
# compiled straight from stub.c with the compiler's defaults, so on an ELF leg
21+
# it would fail A1d for a reason that has nothing to do with packaging.
22+
# CBM_COMPOSITION_FIXTURE=1 tells the gate this target is a fixture; the gate
23+
# prints A1d as n/a and runs everything else unchanged. Release derivation
24+
# never sets it.
1725
set -euo pipefail
26+
export CBM_COMPOSITION_FIXTURE=1
1827

1928
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
2029
FIX="$(mktemp -d "${TMPDIR:-/tmp}/cbm-mcpb-contract.XXXXXX")"

‎tests/test_release_candidate_derivation_contract.sh‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# Contract: release candidates are two immutable derivations of one linker
33
# output. This uses the host's real compiler/strip/signing tools.
44
set -euo pipefail
5+
# The input below is a stub compiled with the compiler's defaults, not a
6+
# release link: it exercises derivation (strip/codesign/hash binding), not the
7+
# link flags. Declare it a fixture so the composition gate reports A1d-bind-now
8+
# (eager binding, a -z now property of Makefile.cbm) as n/a instead of failing
9+
# on the fixture's own link; every other assertion still runs on it.
10+
export CBM_COMPOSITION_FIXTURE=1
511

612
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
713
FIX="$(mktemp -d "${TMPDIR:-/tmp}/cbm-candidate-derive.XXXXXX")"

0 commit comments

Comments
 (0)