Skip to content

Commit e82fe11

Browse files
committed
the reader was a byte match and the hosts do not agree about binaries
Leg 1 of the builtins criterion failed on the macOS host with all three readings 0, which is what leg 1 exists to report: the two legs behind it were measuring nothing. The cause is the reader, not the compiler. `grep -ac memset_pattern16` reads 1/0 correctly with GNU grep, and the macOS runner's grep is BSD, where what `-a` promises about a binary file differs. The name being present in an object's string table made a byte match look like it needed no tool; it needed agreement about binary input instead. `llvm-nm -u` is in the payload beside the clang already being used, costs the same lookup, and asks the question the step is actually asking. Measured unchanged on Linux: 1 / 1 / 0, engine 0, and the control against the previous binary still fails at the link.
1 parent e3a6aec commit e82fe11

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

‎.github/workflows/openkal-cross.yml‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,16 @@ jobs:
311311
BIN="${MCPP_HOME:-$HOME/.mcpp}/registry/data/xpkgs/xim-x-llvm/22.1.8/bin"
312312
# Not `ls ... | head -1`: with `pipefail` the absent candidate's
313313
# exit status ends the step before the guard below is reached.
314-
CLANG=""
315-
for c in "$BIN/clang" "$BIN/clang.exe"; do
316-
if [ -x "$c" ]; then CLANG="$c"; break; fi
317-
done
318-
[ -n "$CLANG" ] || { echo "::error::no clang under $BIN"; exit 1; }
314+
pick() { # $1..$n = candidate paths; prints the first executable one
315+
for c in "$@"; do
316+
if [ -x "$c" ]; then printf '%s' "$c"; return 0; fi
317+
done
318+
return 1
319+
}
320+
CLANG="$(pick "$BIN/clang" "$BIN/clang.exe")" \
321+
|| { echo "::error::no clang under $BIN"; exit 1; }
322+
NM="$(pick "$BIN/llvm-nm" "$BIN/llvm-nm.exe")" \
323+
|| { echo "::error::no llvm-nm under $BIN"; exit 1; }
319324
320325
# Inside the clone, so the dependency is named by a relative path.
321326
# `$RUNNER_TEMP` is a backslash path on the Windows host and a TOML
@@ -353,9 +358,16 @@ jobs:
353358
default = "llvm@22.1.8"
354359
PROJECT
355360
356-
# The symbol name is in the object's string table, so a byte match
357-
# reads it without naming an `llvm-nm` whose path differs per host.
358-
refs() { grep -ac memset_pattern16 "$1" 2>/dev/null || true; }
361+
# THE READER ASKS FOR UNDEFINED SYMBOLS, NOT FOR BYTES.
362+
#
363+
# This was `grep -ac memset_pattern16`, on the reasoning that the name
364+
# is in the object's string table and a byte match needs no tool. It
365+
# reads 1/0 correctly with GNU grep and read 0 for all three legs on
366+
# the macOS host, where grep is BSD: the object is binary, and what
367+
# `-a` promises about that differs between the two. Leg 1 is what
368+
# reported it. `llvm-nm` is in the payload beside the clang already
369+
# being used, and answers the question this step is actually asking.
370+
refs() { "$NM" -u "$1" 2>/dev/null | grep -c memset_pattern16 || true; }
359371
T=--target=arm64-apple-macos14.0
360372
361373
"$CLANG" $T -O2 -c "$W/src/main.cpp" -o "$W/bare.o"

0 commit comments

Comments
 (0)