@@ -36,41 +36,54 @@ jobs:
3636 "$MCPP" test -p boost-ext.ut || true
3737 bin=$(find tests/examples/boost-ext.ut/target -name 'ut' -type f | head -1)
3838 echo "BIN=$bin"
39+ echo "=== init_offsets entries (raw) ==="
40+ otool -s __TEXT __init_offsets "$bin" 2>/dev/null || true
3941 echo "=== symbolize __init_offsets (ASLR off) ==="
40- offs=$(otool -s __TEXT __init_offsets "$bin" 2>/dev/null | awk '/Contents of/{next} { for(i=1;i<=NF;i++) print $i}')
42+ offs=$(otool -s __TEXT __init_offsets "$bin" 2>/dev/null | awk 'NR>2 { for(i=1;i<=NF;i++) if ($i ~ /^[0-9a-f]{8}$/ ) print $i}')
4143 printf 'settings set target.disable-aslr true\nrun\n' > /tmp/x.lldb
4244 for off in $offs; do
4345 addr=$((16#$off))
4446 printf 'image lookup -a 0x%x\n' $((0x100000000 + addr)) >> /tmp/x.lldb
4547 done
46- lldb -b -s /tmp/x.lldb -- "$bin" 2>&1 | grep -E "image lookup|Summary:|Function:|0x100000 " | head -60 || true
48+ lldb -b -s /tmp/x.lldb -- "$bin" 2>&1 | grep -E "image lookup -a |Summary:|Function:" | head -80 || true
4749 - name : relink matrix + guard test
4850 shell : bash
4951 env :
5052 MCPP_INDEX_MIRROR : GLOBAL
5153 run : |
5254 clang=$(python3 -c "import json;print(json.load(open('tests/examples/boost-ext.ut/compile_commands.json'))[0]['arguments'][0])")
5355 pkgroot=$(dirname $(dirname $clang))
54- d=$(ls -d tests/examples/boost-ext.ut/target/aarch64-macos/*/ | head -1)
56+ d=$(ls -d "$GITHUB_WORKSPACE/ tests/examples/boost-ext.ut/target/aarch64-macos" /*/ | head -1)
5557 cd "$d"
5658 C="$clang -nostdinc++ -isystem $pkgroot/include/c++/v1 --sysroot=$(xcrun --show-sdk-path) -mmacosx-version-min=14.0"
5759 stdpcm=$(ls pcm.cache/std.pcm 2>/dev/null)
58- cppm=$(find tests/examples/boost-ext.ut -path '*generated*/boost.ut.cppm' | head -1)
60+ cppm=$(find "$GITHUB_WORKSPACE/ tests/examples/boost-ext.ut" -path '*generated*/boost.ut.cppm' | head -1)
5961 echo "CPPM=$cppm STD=$stdpcm"
6062 runit() { if ./"$1" >/tmp/out.txt 2>&1; then echo "$2 exit: 0 :: $(head -1 /tmp/out.txt)"; else echo "$2 exit: $? :: $(head -1 /tmp/out.txt)"; fi; }
61- $C -o ut_f obj/ut.o obj/boost.ut.m.o "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2
63+ $C -o ut_f obj/ut.o obj/boost.ut.m.o "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2 || true
6264 runit ut_f "F(static plain)"
63- $C -o ut_g obj/ut.o obj/boost.ut.m.o -Wl,-no_dead_strip "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2
65+ $C -o ut_g obj/ut.o obj/boost.ut.m.o -Wl,-no_dead_strip "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2 || true
6466 runit ut_g "G(no_dead_strip)"
65- echo "=== K: recompile cppm with ios_base::Init guard, static link ==="
67+ $C -o ut_d obj/ut.o obj/boost.ut.m.o -Wl,-dead_strip "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2 || true
68+ runit ut_d "D(dead_strip explicit)"
69+ $C -o ut_m obj/ut.o obj/boost.ut.m.o -L"$pkgroot/lib" -lc++ -lc++abi 2>&1 | tail -2 || true
70+ otool -L ut_m 2>/dev/null | grep -i c++ || true
71+ runit ut_m "M(xpkg dylib)"
72+ tmp=$(mktemp -d)
73+ (cd "$tmp" && ar -t "$pkgroot/lib/libc++.a" | grep -i iostream && ar -x "$pkgroot/lib/libc++.a" $(ar -t "$pkgroot/lib/libc++.a" | grep -i iostream) 2>/dev/null) || true
74+ ls "$tmp" || true
75+ $C -o ut_i obj/ut.o obj/boost.ut.m.o "$tmp"/*.o "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2 || true
76+ runit ut_i "I(force iostream.o)"
77+ echo "=== K: cppm + ios_base::Init guard, static link ==="
6678 cp "$cppm" /tmp/guarded.cppm
6779 python3 -c "p='/tmp/guarded.cppm'; s=open(p).read(); g='namespace {\nstruct [[maybe_unused]] ut_stream_guard { std::ios_base::Init init; };\n[[maybe_unused]] ut_stream_guard ut_ensure_streams{};\n}\n'; m='#define BOOST_UT_CXX_MODULES 1'; assert m in s; open(p,'w').write(s.replace(m, g+m)); print('guard injected')"
68- $C -std=c++23 -fmodule-file=std=$stdpcm -fprebuilt-module-path=pcm.cache -O0 -g --no-default-config -Wno-template-body -c /tmp/guarded.cppm -o obj/guarded.m.o 2>&1 | tail -3
69- $C -o ut_k obj/ut.o obj/guarded.m.o "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2
80+ $C -std=c++23 -fmodule-file=std=$stdpcm -fmodule-file=std.compat=pcm.cache/std.compat.pcm - fprebuilt-module-path=pcm.cache -O0 -g --no-default-config -Wno-template-body -c /tmp/guarded.cppm -o obj/guarded.m.o 2>&1 | tail -3 || true
81+ $C -o ut_k obj/ut.o obj/guarded.m.o "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2 || true
7082 runit ut_k "K(guard static plain)"
71- echo " K initializer order:"; printf 'settings set target.disable-aslr true\nrun\n' > /tmp/y.lldb
72- offs=$(otool -s __TEXT __init_offsets ut_k 2>/dev/null | awk '/Contents of/{next} {for(i=1;i<=NF;i++) print $i}')
73- for off in $offs; do addr=$((16#$off)); printf 'image lookup -a 0x%x\n' $((0x100000000 + addr)) >> /tmp/y.lldb; done
74- lldb -b -s /tmp/y.lldb -- ./ut_k 2>&1 | grep -E "Summary:|Function:" | head -30 || true
75- $C -o ut_l obj/ut.o obj/guarded.m.o -Wl,-no_dead_strip "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2
83+ $C -o ut_l obj/ut.o obj/guarded.m.o -Wl,-no_dead_strip "$pkgroot/lib/libc++.a" "$pkgroot/lib/libc++abi.a" 2>&1 | tail -2 || true
7684 runit ut_l "L(guard no_dead_strip)"
85+ echo "=== K init_offsets symbolization ==="
86+ offs=$(otool -s __TEXT __init_offsets ut_k 2>/dev/null | awk 'NR>2 {for(i=1;i<=NF;i++) if ($i ~ /^[0-9a-f]{8}$/) print $i}')
87+ printf 'settings set target.disable-aslr true\nrun\n' > /tmp/y.lldb
88+ for off in $offs; do addr=$((16#$off)); printf 'image lookup -a 0x%x\n' $((0x100000000 + addr)) >> /tmp/y.lldb; done
89+ lldb -b -s /tmp/y.lldb -- ./ut_k 2>&1 | grep -E "image lookup -a|Summary:|Function:" | head -80 || true
0 commit comments