authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-10 00:59:29-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-10 01:00:37-07:00
log798c68d5a5bb2ac971093306212950bcb7043c78
tree84ea795b2b20bcc234f01797ddfa3438306fdee3
parent854b88fda0dc6e92399c27f819bb2a0f5c090eb9

tsan: update build logic for tsan from llvm 17.0.6


1 files changed, 35 insertions(+), 13 deletions(-)

src/libtsan.zig+35-13
......@@ -92,7 +92,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
9292
9393 try cflags.append("-nostdinc++");
9494 try cflags.append("-fvisibility-inlines-hidden");
95 try cflags.append("-std=c++14");
95 try cflags.append("-std=c++17");
9696 try cflags.append("-fno-rtti");
9797
9898 c_source_files.appendAssumeCapacity(.{
......@@ -102,10 +102,11 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
102102 });
103103 }
104104
105 const platform_tsan_sources = if (target.isDarwin())
106 &darwin_tsan_sources
107 else
108 &unix_tsan_sources;
105 const platform_tsan_sources = switch (target.os.tag) {
106 .ios, .macos, .watchos, .tvos => &darwin_tsan_sources,
107 .windows => &windows_tsan_sources,
108 else => &unix_tsan_sources,
109 };
109110 try c_source_files.ensureUnusedCapacity(platform_tsan_sources.len);
110111 for (platform_tsan_sources) |tsan_src| {
111112 var cflags = std.ArrayList([]const u8).init(arena);
......@@ -115,7 +116,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
115116
116117 try cflags.append("-nostdinc++");
117118 try cflags.append("-fvisibility-inlines-hidden");
118 try cflags.append("-std=c++14");
119 try cflags.append("-std=c++17");
119120 try cflags.append("-fno-rtti");
120121
121122 c_source_files.appendAssumeCapacity(.{
......@@ -155,10 +156,12 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
155156
156157 try cflags.append("-I");
157158 try cflags.append(sanitizer_common_include_path);
159 try cflags.append("-I");
160 try cflags.append(tsan_include_path);
158161
159162 try cflags.append("-nostdinc++");
160163 try cflags.append("-fvisibility-inlines-hidden");
161 try cflags.append("-std=c++14");
164 try cflags.append("-std=c++17");
162165 try cflags.append("-fno-rtti");
163166
164167 c_source_files.appendAssumeCapacity(.{
......@@ -180,10 +183,12 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
180183
181184 try cflags.append("-I");
182185 try cflags.append(sanitizer_common_include_path);
186 try cflags.append("-I");
187 try cflags.append(tsan_include_path);
183188
184189 try cflags.append("-nostdinc++");
185190 try cflags.append("-fvisibility-inlines-hidden");
186 try cflags.append("-std=c++14");
191 try cflags.append("-std=c++17");
187192 try cflags.append("-fno-rtti");
188193
189194 c_source_files.appendAssumeCapacity(.{
......@@ -204,7 +209,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
204209
205210 try cflags.append("-nostdinc++");
206211 try cflags.append("-fvisibility-inlines-hidden");
207 try cflags.append("-std=c++14");
212 try cflags.append("-std=c++17");
208213 try cflags.append("-fno-rtti");
209214
210215 c_source_files.appendAssumeCapacity(.{
......@@ -233,7 +238,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
233238
234239 try cflags.append("-nostdinc++");
235240 try cflags.append("-fvisibility-inlines-hidden");
236 try cflags.append("-std=c++14");
241 try cflags.append("-std=c++17");
237242 try cflags.append("-fno-rtti");
238243
239244 c_source_files.appendAssumeCapacity(.{
......@@ -278,12 +283,12 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
278283}
279284
280285const tsan_sources = [_][]const u8{
281 "tsan_clock.cpp",
282286 "tsan_debugging.cpp",
283287 "tsan_external.cpp",
284288 "tsan_fd.cpp",
285289 "tsan_flags.cpp",
286290 "tsan_ignoreset.cpp",
291 "tsan_interceptors_memintrinsics.cpp",
287292 "tsan_interceptors_posix.cpp",
288293 "tsan_interface.cpp",
289294 "tsan_interface_ann.cpp",
......@@ -293,9 +298,12 @@ const tsan_sources = [_][]const u8{
293298 "tsan_md5.cpp",
294299 "tsan_mman.cpp",
295300 "tsan_mutexset.cpp",
301 "tsan_new_delete.cpp",
302 "tsan_platform_windows.cpp",
296303 "tsan_preinit.cpp",
297304 "tsan_report.cpp",
298305 "tsan_rtl.cpp",
306 "tsan_rtl_access.cpp",
299307 "tsan_rtl_mutex.cpp",
300308 "tsan_rtl_proc.cpp",
301309 "tsan_rtl_report.cpp",
......@@ -304,6 +312,7 @@ const tsan_sources = [_][]const u8{
304312 "tsan_suppressions.cpp",
305313 "tsan_symbolize.cpp",
306314 "tsan_sync.cpp",
315 "tsan_vector_clock.cpp",
307316};
308317
309318const darwin_tsan_sources = [_][]const u8{
......@@ -318,9 +327,17 @@ const unix_tsan_sources = [_][]const u8{
318327 "tsan_platform_posix.cpp",
319328};
320329
330const windows_tsan_sources = [_][]const u8{
331 "tsan_platform_windows.cpp",
332};
333
321334const sanitizer_common_sources = [_][]const u8{
322335 "sanitizer_allocator.cpp",
336 "sanitizer_chained_origin_depot.cpp",
323337 "sanitizer_common.cpp",
338 "sanitizer_coverage_win_dll_thunk.cpp",
339 "sanitizer_coverage_win_dynamic_runtime_thunk.cpp",
340 "sanitizer_coverage_win_weak_interception.cpp",
324341 "sanitizer_deadlock_detector1.cpp",
325342 "sanitizer_deadlock_detector2.cpp",
326343 "sanitizer_errno.cpp",
......@@ -335,8 +352,6 @@ const sanitizer_common_sources = [_][]const u8{
335352 "sanitizer_mac.cpp",
336353 "sanitizer_mutex.cpp",
337354 "sanitizer_netbsd.cpp",
338 "sanitizer_openbsd.cpp",
339 "sanitizer_persistent_allocator.cpp",
340355 "sanitizer_platform_limits_freebsd.cpp",
341356 "sanitizer_platform_limits_linux.cpp",
342357 "sanitizer_platform_limits_netbsd.cpp",
......@@ -351,15 +366,22 @@ const sanitizer_common_sources = [_][]const u8{
351366 "sanitizer_procmaps_linux.cpp",
352367 "sanitizer_procmaps_mac.cpp",
353368 "sanitizer_procmaps_solaris.cpp",
369 "sanitizer_range.cpp",
354370 "sanitizer_solaris.cpp",
371 "sanitizer_stack_store.cpp",
355372 "sanitizer_stoptheworld_fuchsia.cpp",
356373 "sanitizer_stoptheworld_mac.cpp",
374 "sanitizer_stoptheworld_win.cpp",
357375 "sanitizer_suppressions.cpp",
358376 "sanitizer_termination.cpp",
377 "sanitizer_thread_arg_retval.cpp",
359378 "sanitizer_thread_registry.cpp",
360379 "sanitizer_tls_get_addr.cpp",
361380 "sanitizer_type_traits.cpp",
362381 "sanitizer_win.cpp",
382 "sanitizer_win_dll_thunk.cpp",
383 "sanitizer_win_dynamic_runtime_thunk.cpp",
384 "sanitizer_win_weak_interception.cpp",
363385};
364386
365387const sanitizer_nolibc_sources = [_][]const u8{