From 14992361a4ef6355443b774e8dd2888e6c365af4 Mon Sep 17 00:00:00 2001 From: Louis Montagne Date: Tue, 5 May 2026 16:20:45 +0200 Subject: [PATCH] zink: relax build-id length assertion for Mach-O `disk_cache_init` asserts `build_id_len == BUILD_ID_EXPECTED_HASH_LENGTH` (20, the size of a GNU build-id SHA1 on ELF). Mach-O has no GNU build-id; the closest equivalent is `LC_UUID`, which is 16 bytes. `build_id_length()` therefore returns a non-20 value on macOS and the assert fires as soon as `ENABLE_SHADER_CACHE` is on. Relax the assertion to `<=` so any non-empty build id of acceptable length is accepted while still catching impossibly long ones. The hash only needs *some* unique-per-build identifier; the actual byte count hashed is whatever `build_id_length()` returned. Cc: mesa-stable Suggested-by: Mike Blumenkrantz Signed-off-by: Louis Montagne Part-of: --- src/gallium/drivers/zink/zink_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index e56ecb7a7c0..9084c911b38 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -318,7 +318,7 @@ disk_cache_init(struct zink_screen *screen) const struct build_id_note *note = build_id_find_nhdr_for_addr(disk_cache_init); unsigned build_id_len = build_id_length(note); - assert(note && build_id_len == BUILD_ID_EXPECTED_HASH_LENGTH); + assert(note && build_id_len <= BUILD_ID_EXPECTED_HASH_LENGTH); _mesa_blake3_update(&ctx, build_id_data(note), build_id_len); #endif