authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2023-07-20 16:00:11+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-20 16:14:12-07:00
log124448c1b6d73df6f20901888c79435e4d9e3da7
tree4796cf5645f3f4e4ea6c118b95d0327ee65cc21a
parent3f15010abe5c5efaed16799fcb94c9f84117bdde

Include system headers path when targeting assembly_with_cpp

This is consistent with what clang and gcc are doing, because headers such as <cet.h> are specifically designed to be used in the context of assembly code. Fixes #16449

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

src/Compilation.zig+6
......@@ -4438,6 +4438,12 @@ pub fn addCCArgs(
44384438 },
44394439 .shared_library, .ll, .bc, .unknown, .static_library, .object, .def, .zig, .res => {},
44404440 .assembly, .assembly_with_cpp => {
4441 if (ext == .assembly_with_cpp) {
4442 const c_headers_dir = try std.fs.path.join(arena, &[_][]const u8{ comp.zig_lib_directory.path.?, "include" });
4443 try argv.append("-isystem");
4444 try argv.append(c_headers_dir);
4445 }
4446
44414447 // The Clang assembler does not accept the list of CPU features like the
44424448 // compiler frontend does. Therefore we must hard-code the -m flags for
44434449 // all CPU features here.