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