From 0142405f8643d9e464991fb7606b0c5849cf64a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 26 May 2026 08:09:11 +0200 Subject: [PATCH] std.os.linux.tls: add xtensa support --- lib/std/os/linux/tls.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig index e188f954626cb7b6ad9b78faf5d723ffc2eae4cd..ef87253cec80f6fb526994bcca2570cb998789aa 100644 --- a/lib/std/os/linux/tls.zig +++ b/lib/std/os/linux/tls.zig @@ -78,6 +78,8 @@ const current_variant: Variant = switch (native_arch) { .sheb, .thumb, .thumbeb, + .xtensa, + .xtensaeb, => .I_original, .loongarch32, .loongarch64, @@ -152,6 +154,8 @@ const AbiTcb = switch (current_variant) { .sheb, .thumb, .thumbeb, + .xtensa, + .xtensaeb, => extern struct { /// This is offset by `current_dtv_offset`. dtv: usize, @@ -364,6 +368,13 @@ pub fn setThreadPointer(addr: usize) void { : [addr] "r" (addr), ); }, + .xtensa, .xtensaeb => { + asm volatile ( + \\ wur %[addr], threadptr + : + : [addr] "a" (addr), + ); + }, else => @compileError("Unsupported architecture"), } } -- 2.54.0