authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-17 21:09:54-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-18 12:22:46-07:00
log228a0937a2bb761b3a63d98ddda5402a1f594fe8
tree07237e4e9498ee5d381146a2206a9b74bd7a3741
parent7dab3ae135bbe388b412f06bcd8910b86565635e

memory fences to make sure TLS init happens


1 files changed, 2 insertions(+), 0 deletions(-)

lib/std/start.zig+2
...@@ -206,6 +206,7 @@ fn posixCallMainAndExit() noreturn {...@@ -206,6 +206,7 @@ fn posixCallMainAndExit() noreturn {
206 // Do this as early as possible, the aux vector is needed206 // Do this as early as possible, the aux vector is needed
207 if (builtin.position_independent_executable) {207 if (builtin.position_independent_executable) {
208 @import("os/linux/start_pie.zig").apply_relocations();208 @import("os/linux/start_pie.zig").apply_relocations();
209 @fence(.SeqCst);
209 }210 }
210211
211 // Initialize the TLS area. We do a runtime check here to make sure212 // Initialize the TLS area. We do a runtime check here to make sure
...@@ -214,6 +215,7 @@ fn posixCallMainAndExit() noreturn {...@@ -214,6 +215,7 @@ fn posixCallMainAndExit() noreturn {
214 const is_dynamic = @import("dynamic_library.zig").get_DYNAMIC() != null;215 const is_dynamic = @import("dynamic_library.zig").get_DYNAMIC() != null;
215 if (!is_dynamic) {216 if (!is_dynamic) {
216 std.os.linux.tls.initStaticTLS();217 std.os.linux.tls.initStaticTLS();
218 @fence(.SeqCst);
217 }219 }
218220
219 {221 {