Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(sidecar): Windows server build puts jump tables in .rdata (FEHLER-E1 #1)

purplef3f91b65fa99
diff --git a/scripts/build-llama-flags.test.mjs b/scripts/build-llama-flags.test.mjs
index 7e106a17..e433b4fd 100644
--- a/scripts/build-llama-flags.test.mjs
+++ b/scripts/build-llama-flags.test.mjs
@@ -109,5 +109,15 @@ test('P11 #9: the Windows vector tool puts jump tables in .rdata, without replac
assert.doesNotMatch(flags, /-DCMAKE_(C|CXX)_FLAGS=/, 'CMAKE_<LANG>_FLAGS would drop /EHsc and the other MSVC defaults');
assert.doesNotMatch(flags, /\/jumptablerdata/, 'MSYS rewrites a leading slash into a path, as with /MAP');
assert.doesNotMatch(sourced('cvector_cmake_flags_for x86_64-unknown-linux-gnu'), /jumptablerdata/);
- assert.doesNotMatch(cmakeFlagsFor('x86_64-pc-windows-msvc'), /jumptablerdata/, 'the server build stays as it is');
+});
+
+test('E1 #1: the Windows server build puts jump tables in .rdata too, without replacing the MSVC defaults', () => {
+ const flags = cmakeFlagsFor('x86_64-pc-windows-msvc');
+ assert.match(flags, /-DCMAKE_C_FLAGS_INIT=-jumptablerdata\b/);
+ assert.match(flags, /-DCMAKE_CXX_FLAGS_INIT=-jumptablerdata\b/);
+ assert.doesNotMatch(flags, /-DCMAKE_(C|CXX)_FLAGS=/, 'CMAKE_<LANG>_FLAGS would drop /EHsc and the other MSVC defaults');
+ assert.doesNotMatch(flags, /\/jumptablerdata/, 'MSYS rewrites a leading slash into a path, as with /MAP');
+ assert.match(flags, /-DCMAKE_MODULE_LINKER_FLAGS=-MAP\b/, 'the linker maps stay');
+ assert.doesNotMatch(cmakeFlagsFor('x86_64-unknown-linux-gnu'), /jumptablerdata/, 'MSVC only');
+ assert.doesNotMatch(cmakeFlagsFor('aarch64-apple-darwin'), /jumptablerdata/, 'MSVC only');
});
diff --git a/scripts/build-llama.sh b/scripts/build-llama.sh
index 56dd1f0f..90a125c1 100755
--- a/scripts/build-llama.sh
+++ b/scripts/build-llama.sh
@@ -164,7 +164,14 @@ cmake_flags_for() {
# files verify-sidecar-isa.sh's Windows guard most needs a map for,
# since they are where an unconditional-AVX regression would actually
# ship. All three linker-flags variables now carry -MAP.
- echo "$common -DBUILD_SHARED_LIBS=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON -DCMAKE_SHARED_LINKER_FLAGS=-MAP -DCMAKE_EXE_LINKER_FLAGS=-MAP -DCMAKE_MODULE_LINKER_FLAGS=-MAP" ;;
+ #
+ # -jumptablerdata (FEHLER-E1 #1): same reason and spelling as the vector
+ # tool's build (cvector_cmake_flags_for, FEHLER-P11 #9). With b11960 the
+ # guard read a switch jump table that MSVC had put in llama.dll's .text
+ # as "vsqrtph zmm28" at $LN954 of unicode.obj; nothing in that object
+ # can emit EVEX (no /arch outside ggml-cpu). In .rdata the guard no
+ # longer reads tables as code, so a hit that stays is real code.
+ echo "$common -DBUILD_SHARED_LIBS=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON -DCMAKE_SHARED_LINKER_FLAGS=-MAP -DCMAKE_EXE_LINKER_FLAGS=-MAP -DCMAKE_MODULE_LINKER_FLAGS=-MAP -DCMAKE_C_FLAGS_INIT=-jumptablerdata -DCMAKE_CXX_FLAGS_INIT=-jumptablerdata" ;;
x86_64-unknown-linux-gnu)
# CMAKE_BUILD_RPATH_USE_ORIGIN=ON (BLOCKER B3): without it,
# CMAKE_BUILD_WITH_INSTALL_RPATH's OFF default still makes CMake write