| ... | ... | @@ -37,17 +37,13 @@ const libcxxabi_files = [_][]const u8{ |
| 37 | 37 | "src/stdlib_typeinfo.cpp", |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | | const libcxx_files = [_][]const u8{ |
| 40 | const libcxx_base_files = [_][]const u8{ |
| 41 | 41 | "src/algorithm.cpp", |
| 42 | 42 | "src/any.cpp", |
| 43 | | "src/atomic.cpp", |
| 44 | | "src/barrier.cpp", |
| 45 | 43 | "src/bind.cpp", |
| 46 | 44 | "src/call_once.cpp", |
| 47 | 45 | "src/charconv.cpp", |
| 48 | 46 | "src/chrono.cpp", |
| 49 | | "src/condition_variable.cpp", |
| 50 | | "src/condition_variable_destructor.cpp", |
| 51 | 47 | "src/error_category.cpp", |
| 52 | 48 | "src/exception.cpp", |
| 53 | 49 | "src/experimental/keep.cpp", |
| ... | ... | @@ -62,7 +58,6 @@ const libcxx_files = [_][]const u8{ |
| 62 | 58 | "src/filesystem/path.cpp", |
| 63 | 59 | "src/fstream.cpp", |
| 64 | 60 | "src/functional.cpp", |
| 65 | | "src/future.cpp", |
| 66 | 61 | "src/hash.cpp", |
| 67 | 62 | "src/ios.cpp", |
| 68 | 63 | "src/ios.instantiations.cpp", |
| ... | ... | @@ -71,8 +66,6 @@ const libcxx_files = [_][]const u8{ |
| 71 | 66 | "src/locale.cpp", |
| 72 | 67 | "src/memory.cpp", |
| 73 | 68 | "src/memory_resource.cpp", |
| 74 | | "src/mutex.cpp", |
| 75 | | "src/mutex_destructor.cpp", |
| 76 | 69 | "src/new.cpp", |
| 77 | 70 | "src/new_handler.cpp", |
| 78 | 71 | "src/new_helpers.cpp", |
| ... | ... | @@ -86,7 +79,6 @@ const libcxx_files = [_][]const u8{ |
| 86 | 79 | "src/ryu/d2fixed.cpp", |
| 87 | 80 | "src/ryu/d2s.cpp", |
| 88 | 81 | "src/ryu/f2s.cpp", |
| 89 | | "src/shared_mutex.cpp", |
| 90 | 82 | "src/stdexcept.cpp", |
| 91 | 83 | "src/string.cpp", |
| 92 | 84 | "src/strstream.cpp", |
| ... | ... | @@ -95,9 +87,7 @@ const libcxx_files = [_][]const u8{ |
| 95 | 87 | "src/support/ibm/xlocale_zos.cpp", |
| 96 | 88 | "src/support/win32/locale_win32.cpp", |
| 97 | 89 | "src/support/win32/support.cpp", |
| 98 | | "src/support/win32/thread_win32.cpp", |
| 99 | 90 | "src/system_error.cpp", |
| 100 | | "src/thread.cpp", |
| 101 | 91 | "src/typeinfo.cpp", |
| 102 | 92 | "src/tz.cpp", |
| 103 | 93 | "src/tzdb_list.cpp", |
| ... | ... | @@ -107,6 +97,19 @@ const libcxx_files = [_][]const u8{ |
| 107 | 97 | "src/verbose_abort.cpp", |
| 108 | 98 | }; |
| 109 | 99 | |
| 100 | const libcxx_thread_files = [_][]const u8{ |
| 101 | "src/atomic.cpp", |
| 102 | "src/barrier.cpp", |
| 103 | "src/condition_variable.cpp", |
| 104 | "src/condition_variable_destructor.cpp", |
| 105 | "src/future.cpp", |
| 106 | "src/mutex.cpp", |
| 107 | "src/mutex_destructor.cpp", |
| 108 | "src/shared_mutex.cpp", |
| 109 | "src/support/win32/thread_win32.cpp", |
| 110 | "src/thread.cpp", |
| 111 | }; |
| 112 | |
| 110 | 113 | pub const BuildError = error{ |
| 111 | 114 | OutOfMemory, |
| 112 | 115 | SubCompilationFailed, |
| ... | ... | @@ -210,6 +213,11 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 210 | 213 | return error.SubCompilationFailed; |
| 211 | 214 | }; |
| 212 | 215 | |
| 216 | const libcxx_files = if (comp.config.any_non_single_threaded) |
| 217 | &(libcxx_base_files ++ libcxx_thread_files) |
| 218 | else |
| 219 | &libcxx_base_files; |
| 220 | |
| 213 | 221 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); |
| 214 | 222 | |
| 215 | 223 | for (libcxx_files) |cxx_src| { |
| ... | ... | @@ -223,16 +231,10 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 223 | 231 | |
| 224 | 232 | if (std.mem.startsWith(u8, cxx_src, "src/support/win32/") and target.os.tag != .windows) |
| 225 | 233 | continue; |
| 226 | | if (std.mem.startsWith(u8, cxx_src, "src/support/solaris/") and !target.os.tag.isSolarish()) |
| 227 | | continue; |
| 228 | 234 | if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos) |
| 229 | 235 | continue; |
| 230 | | if (!comp.config.any_non_single_threaded) { |
| 231 | | if (std.mem.startsWith(u8, cxx_src, "src/support/win32/thread_win32.cpp")) { |
| 232 | | continue; |
| 233 | | } |
| 236 | if (!comp.config.any_non_single_threaded) |
| 234 | 237 | try cflags.append("-D_LIBCPP_HAS_NO_THREADS"); |
| 235 | | } |
| 236 | 238 | |
| 237 | 239 | try cflags.append("-DNDEBUG"); |
| 238 | 240 | try cflags.append(hardeningModeFlag(optimize_mode)); |