aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-12-17 21:09:54 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-12-18 12:22:46 -0700
commit228a0937a2bb761b3a63d98ddda5402a1f594fe8 (patch)
tree07237e4e9498ee5d381146a2206a9b74bd7a3741 /lib
parent7dab3ae135bbe388b412f06bcd8910b86565635e (diff)
downloadzig-228a0937a2bb761b3a63d98ddda5402a1f594fe8.tar.gz
zig-228a0937a2bb761b3a63d98ddda5402a1f594fe8.zip
memory fences to make sure TLS init happens
Diffstat (limited to 'lib')
-rw-r--r--lib/std/start.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 6249a6e1ac..d3065c7719 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -206,6 +206,7 @@ fn posixCallMainAndExit() noreturn {
// Do this as early as possible, the aux vector is needed
if (builtin.position_independent_executable) {
@import("os/linux/start_pie.zig").apply_relocations();
+ @fence(.SeqCst);
}
// Initialize the TLS area. We do a runtime check here to make sure
@@ -214,6 +215,7 @@ fn posixCallMainAndExit() noreturn {
const is_dynamic = @import("dynamic_library.zig").get_DYNAMIC() != null;
if (!is_dynamic) {
std.os.linux.tls.initStaticTLS();
+ @fence(.SeqCst);
}
{