Commit aff557e4e8

Alex Rønne Petersen <alex@alexrp.com>
2025-10-21 03:50:09
std.os.linux.tls: add sh support
1 parent 5e92126
Changed files (1)
lib
std
os
linux
lib/std/os/linux/tls.zig
@@ -73,6 +73,8 @@ const current_variant: Variant = switch (native_arch) {
     .csky,
     .microblaze,
     .microblazeel,
+    .sh,
+    .sheb,
     .thumb,
     .thumbeb,
     => .I_original,
@@ -144,6 +146,8 @@ const AbiTcb = switch (current_variant) {
         .armeb,
         .microblaze,
         .microblazeel,
+        .sh,
+        .sheb,
         .thumb,
         .thumbeb,
         => extern struct {
@@ -337,6 +341,13 @@ pub fn setThreadPointer(addr: usize) void {
                 : [addr] "r" (addr),
                 : .{ .r0 = true });
         },
+        .sh, .sheb => {
+            asm volatile (
+                \\ ldc gbr, %[addr]
+                :
+                : [addr] "r" (addr),
+            );
+        },
         .sparc, .sparc64 => {
             asm volatile (
                 \\ mov %[addr], %%g7