authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-15 14:43:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:19-07:00
log92b54e50c85488459df0c6579086494e31d9d52a
treeaf47e99a9792be17dd84d00381db662925a8a9f3
parentea0ba4f2b572fad8595ae02ac9c43ab7dd0cc2f2

glibc: update to new Compilation API


6 files changed, 55 insertions(+), 20 deletions(-)

src/Compilation.zig+2
......@@ -6158,6 +6158,7 @@ fn buildOutputFromZig(
61586158 },
61596159 .fully_qualified_name = "root",
61606160 .inherited = .{
6161 .resolved_target = comp.root_mod.resolved_target,
61616162 .strip = comp.compilerRtStrip(),
61626163 .stack_check = false,
61636164 .stack_protector = 0,
......@@ -6269,6 +6270,7 @@ pub fn build_crt_file(
62696270 },
62706271 .fully_qualified_name = "root",
62716272 .inherited = .{
6273 .resolved_target = comp.root_mod.resolved_target,
62726274 .strip = comp.compilerRtStrip(),
62736275 .stack_check = false,
62746276 .stack_protector = 0,
src/glibc.zig+48-20
......@@ -12,7 +12,7 @@ const Compilation = @import("Compilation.zig");
1212const build_options = @import("build_options");
1313const trace = @import("tracy.zig").trace;
1414const Cache = std.Build.Cache;
15const Package = @import("Package.zig");
15const Module = @import("Package/Module.zig");
1616
1717pub const Lib = struct {
1818 name: []const u8,
......@@ -1067,34 +1067,62 @@ fn buildSharedLib(
10671067 .src_path = try path.join(arena, &[_][]const u8{ bin_directory.path.?, asm_file_basename }),
10681068 },
10691069 };
1070
1071 const optimize_mode = comp.compilerRtOptMode();
1072 const strip = comp.compilerRtStrip();
1073 const config = try Compilation.Config.resolve(.{
1074 .output_mode = .Lib,
1075 .link_mode = .Dynamic,
1076 .resolved_target = comp.root_mod.resolved_target,
1077 .is_test = false,
1078 .have_zcu = false,
1079 .emit_bin = true,
1080 .root_optimize_mode = optimize_mode,
1081 .root_strip = strip,
1082 .link_libc = false,
1083 });
1084
1085 const root_mod = try Module.create(arena, .{
1086 .global_cache_directory = comp.global_cache_directory,
1087 .paths = .{
1088 .root = .{ .root_dir = comp.zig_lib_directory },
1089 .root_src_path = "",
1090 },
1091 .fully_qualified_name = "root",
1092 .inherited = .{
1093 .resolved_target = comp.root_mod.resolved_target,
1094 .strip = strip,
1095 .stack_check = false,
1096 .stack_protector = 0,
1097 .sanitize_c = false,
1098 .sanitize_thread = false,
1099 .red_zone = comp.root_mod.red_zone,
1100 .omit_frame_pointer = comp.root_mod.omit_frame_pointer,
1101 .valgrind = false,
1102 .optimize_mode = optimize_mode,
1103 .structured_cfg = comp.root_mod.structured_cfg,
1104 },
1105 .global = config,
1106 .cc_argv = &.{},
1107 .parent = null,
1108 .builtin_mod = null,
1109 });
1110
10701111 const sub_compilation = try Compilation.create(comp.gpa, .{
10711112 .local_cache_directory = zig_cache_directory,
10721113 .global_cache_directory = comp.global_cache_directory,
10731114 .zig_lib_directory = comp.zig_lib_directory,
1115 .thread_pool = comp.thread_pool,
1116 .self_exe_path = comp.self_exe_path,
10741117 .cache_mode = .whole,
1075 .target = comp.getTarget(),
1118 .config = config,
1119 .root_mod = root_mod,
10761120 .root_name = lib.name,
1077 .main_mod = null,
1078 .output_mode = .Lib,
1079 .link_mode = .Dynamic,
1080 .thread_pool = comp.thread_pool,
1081 .libc_installation = comp.bin_file.options.libc_installation,
1121 .libc_installation = comp.libc_installation,
10821122 .emit_bin = emit_bin,
1083 .optimize_mode = comp.compilerRtOptMode(),
1084 .want_sanitize_c = false,
1085 .want_stack_check = false,
1086 .want_stack_protector = 0,
1087 .want_red_zone = comp.bin_file.options.red_zone,
1088 .omit_frame_pointer = comp.bin_file.options.omit_frame_pointer,
1089 .want_valgrind = false,
1090 .want_tsan = false,
10911123 .emit_h = null,
1092 .strip = comp.compilerRtStrip(),
1093 .is_native_os = false,
1094 .is_native_abi = false,
1095 .self_exe_path = comp.self_exe_path,
10961124 .verbose_cc = comp.verbose_cc,
1097 .verbose_link = comp.bin_file.options.verbose_link,
1125 .verbose_link = comp.verbose_link,
10981126 .verbose_air = comp.verbose_air,
10991127 .verbose_llvm_ir = comp.verbose_llvm_ir,
11001128 .verbose_llvm_bc = comp.verbose_llvm_bc,
src/libcxx.zig+2
......@@ -251,6 +251,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void {
251251 },
252252 .fully_qualified_name = "root",
253253 .inherited = .{
254 .resolved_target = comp.root_mod.resolved_target,
254255 .strip = strip,
255256 .stack_check = false,
256257 .stack_protector = 0,
......@@ -439,6 +440,7 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void {
439440 },
440441 .fully_qualified_name = "root",
441442 .inherited = .{
443 .resolved_target = comp.root_mod.resolved_target,
442444 .strip = strip,
443445 .stack_check = false,
444446 .stack_protector = 0,
src/libtsan.zig+1
......@@ -219,6 +219,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
219219 },
220220 .fully_qualified_name = "root",
221221 .inherited = .{
222 .resolved_target = comp.root_mod.resolved_target,
222223 .strip = strip,
223224 .stack_check = false,
224225 .stack_protector = 0,
src/libunwind.zig+1
......@@ -40,6 +40,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void {
4040 },
4141 .fully_qualified_name = "root",
4242 .inherited = .{
43 .resolved_target = comp.root_mod.resolved_target,
4344 .strip = comp.compilerRtStrip(),
4445 .stack_check = false,
4546 .stack_protector = 0,
src/musl.zig+1
......@@ -222,6 +222,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
222222 },
223223 .fully_qualified_name = "root",
224224 .inherited = .{
225 .resolved_target = comp.root_mod.resolved_target,
225226 .strip = strip,
226227 .stack_check = false,
227228 .stack_protector = 0,