| author | |
| committer | |
| log | bde87cfc71a0b9d3d2e35e4b2181d1f956ff5711 |
| tree | bdf3b967fbedac01c27b7fd93bfebbf1f7274ef0 |
| parent | 2eda0ef8f075aa24fecdd792a523f260d9177ea8 |
| signature |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/318684 files changed, 17 insertions(+), 22 deletions(-)
src/libs/glibc.zig+13-7| ... | ... | @@ -189,11 +189,11 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 189 | 189 | var args = std.array_list.Managed([]const u8).init(arena); |
| 190 | 190 | try add_include_dirs(comp, arena, &args); |
| 191 | 191 | try args.appendSlice(&[_][]const u8{ |
| 192 | "-w", // Disable all warnings. | |
| 192 | 193 | "-D_LIBC_REENTRANT", |
| 193 | 194 | "-include", |
| 194 | 195 | try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), |
| 195 | 196 | "-DMODULE_NAME=libc", |
| 196 | "-Wno-nonportable-include-path", | |
| 197 | 197 | "-include", |
| 198 | 198 | try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), |
| 199 | 199 | "-DPIC", |
| ... | ... | @@ -217,6 +217,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 217 | 217 | }); |
| 218 | 218 | try add_include_dirs(comp, arena, &args); |
| 219 | 219 | try args.appendSlice(&[_][]const u8{ |
| 220 | "-w", // Disable all warnings. | |
| 220 | 221 | "-D_LIBC_REENTRANT", |
| 221 | 222 | "-DMODULE_NAME=libc", |
| 222 | 223 | "-DTOP_NAMESPACE=glibc", |
| ... | ... | @@ -229,9 +230,16 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 229 | 230 | .owner = undefined, |
| 230 | 231 | }; |
| 231 | 232 | }; |
| 232 | const init_o: Compilation.CSourceFile = .{ | |
| 233 | .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "init.c"), | |
| 234 | .owner = undefined, | |
| 233 | const init_o: Compilation.CSourceFile = blk: { | |
| 234 | var args = std.array_list.Managed([]const u8).init(arena); | |
| 235 | try args.appendSlice(&[_][]const u8{ | |
| 236 | "-w", // Disable all warnings. | |
| 237 | }); | |
| 238 | break :blk .{ | |
| 239 | .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "init.c"), | |
| 240 | .cache_exempt_flags = args.items, | |
| 241 | .owner = undefined, | |
| 242 | }; | |
| 235 | 243 | }; |
| 236 | 244 | var files = [_]Compilation.CSourceFile{ start_o, abi_note_o, init_o }; |
| 237 | 245 | const basename = if (comp.config.output_mode == .Exe and !comp.config.pie) "crt1" else "Scrt1"; |
| ... | ... | @@ -308,15 +316,14 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 308 | 316 | |
| 309 | 317 | var args = std.array_list.Managed([]const u8).init(arena); |
| 310 | 318 | try args.appendSlice(&[_][]const u8{ |
| 319 | "-w", // Disable all warnings. | |
| 311 | 320 | "-std=gnu11", |
| 312 | 321 | "-fgnu89-inline", |
| 313 | 322 | "-fmerge-all-constants", |
| 314 | 323 | "-frounding-math", |
| 315 | "-Wno-unsupported-floating-point-opt", // For targets that don't support -frounding-math. | |
| 316 | 324 | "-fno-common", |
| 317 | 325 | "-fmath-errno", |
| 318 | 326 | "-ftls-model=initial-exec", |
| 319 | "-Wno-ignored-attributes", | |
| 320 | 327 | "-Qunused-arguments", |
| 321 | 328 | }); |
| 322 | 329 | try add_include_dirs(comp, arena, &args); |
| ... | ... | @@ -335,7 +342,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 335 | 342 | "-include", |
| 336 | 343 | try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), |
| 337 | 344 | "-DMODULE_NAME=libc", |
| 338 | "-Wno-nonportable-include-path", | |
| 339 | 345 | "-include", |
| 340 | 346 | try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), |
| 341 | 347 | "-DPIC", |
src/libs/libcxx.zig+2-6| ... | ... | @@ -206,6 +206,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 206 | 206 | |
| 207 | 207 | try addCxxArgs(comp, arena, &cflags); |
| 208 | 208 | |
| 209 | try cflags.append("-w"); // Disable all warnings. | |
| 209 | 210 | try cflags.append("-DNDEBUG"); |
| 210 | 211 | try cflags.append("-DLIBC_NAMESPACE=__llvm_libc_common_utils"); |
| 211 | 212 | try cflags.append("-D_LIBCPP_BUILDING_LIBRARY"); |
| ... | ... | @@ -223,9 +224,6 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 223 | 224 | |
| 224 | 225 | try cflags.append("-nostdinc++"); |
| 225 | 226 | try cflags.append("-std=c++23"); |
| 226 | try cflags.append("-Wno-user-defined-literals"); | |
| 227 | try cflags.append("-Wno-covered-switch-default"); | |
| 228 | try cflags.append("-Wno-suggest-override"); | |
| 229 | 227 | |
| 230 | 228 | // These depend on only the zig lib directory file path, which is |
| 231 | 229 | // purposefully either in the cache or not in the cache. The decision |
| ... | ... | @@ -401,6 +399,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 401 | 399 | |
| 402 | 400 | try addCxxArgs(comp, arena, &cflags); |
| 403 | 401 | |
| 402 | try cflags.append("-w"); // Disable all warnings. | |
| 404 | 403 | try cflags.append("-DNDEBUG"); |
| 405 | 404 | try cflags.append("-D_LIBCPP_BUILDING_LIBRARY"); |
| 406 | 405 | try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY"); |
| ... | ... | @@ -422,9 +421,6 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 422 | 421 | try cflags.append("-nostdinc++"); |
| 423 | 422 | try cflags.append("-fstrict-aliasing"); |
| 424 | 423 | try cflags.append("-std=c++23"); |
| 425 | try cflags.append("-Wno-user-defined-literals"); | |
| 426 | try cflags.append("-Wno-covered-switch-default"); | |
| 427 | try cflags.append("-Wno-suggest-override"); | |
| 428 | 424 | |
| 429 | 425 | // These depend on only the zig lib directory file path, which is |
| 430 | 426 | // purposefully either in the cache or not in the cache. The decision |
src/libs/libunwind.zig+1-7| ... | ... | @@ -104,6 +104,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 104 | 104 | .assembly_with_cpp => {}, |
| 105 | 105 | else => unreachable, // See `unwind_src_list`. |
| 106 | 106 | } |
| 107 | try cflags.append("-w"); // Disable all warnings. | |
| 107 | 108 | try cflags.append("-I"); |
| 108 | 109 | try cflags.append(try comp.dirs.zig_lib.join(arena, &.{ "libunwind", "include" })); |
| 109 | 110 | try cflags.append("-D_LIBUNWIND_HIDE_SYMBOLS"); |
| ... | ... | @@ -126,13 +127,6 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr |
| 126 | 127 | if (target.cpu.arch.isArm() and target.abi.float() == .hard) { |
| 127 | 128 | try cflags.append("-DCOMPILER_RT_ARMHF_TARGET"); |
| 128 | 129 | } |
| 129 | try cflags.append("-Wno-bitwise-conditional-parentheses"); | |
| 130 | try cflags.append("-Wno-visibility"); | |
| 131 | try cflags.append("-Wno-incompatible-pointer-types"); | |
| 132 | ||
| 133 | if (target.os.tag == .windows) { | |
| 134 | try cflags.append("-Wno-dll-attribute-on-redeclaration"); | |
| 135 | } | |
| 136 | 130 | |
| 137 | 131 | c_source_files[i] = .{ |
| 138 | 132 | .src_path = try comp.dirs.zig_lib.join(arena, &.{unwind_src}), |
src/libs/mingw.zig+1-2| ... | ... | @@ -135,8 +135,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 135 | 135 | try addCcArgs(comp, arena, &winpthreads_args); |
| 136 | 136 | try winpthreads_args.appendSlice(&[_][]const u8{ |
| 137 | 137 | "-DIN_WINPTHREAD", |
| 138 | // winpthreads incorrectly assumes that Clang has `-Wprio-ctor-dtor`. | |
| 139 | "-Wno-unknown-warning-option", | |
| 140 | 138 | }); |
| 141 | 139 | |
| 142 | 140 | switch (comp.compilerRtOptMode()) { |
| ... | ... | @@ -170,6 +168,7 @@ fn addCcArgs( |
| 170 | 168 | args: *std.array_list.Managed([]const u8), |
| 171 | 169 | ) error{OutOfMemory}!void { |
| 172 | 170 | try args.appendSlice(&[_][]const u8{ |
| 171 | "-w", // Disable all warnings. | |
| 173 | 172 | "-std=gnu11", |
| 174 | 173 | "-D__USE_MINGW_ANSI_STDIO=0", |
| 175 | 174 |