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(...@@ -6158,6 +6158,7 @@ fn buildOutputFromZig(
6158 },6158 },
6159 .fully_qualified_name = "root",6159 .fully_qualified_name = "root",
6160 .inherited = .{6160 .inherited = .{
6161 .resolved_target = comp.root_mod.resolved_target,
6161 .strip = comp.compilerRtStrip(),6162 .strip = comp.compilerRtStrip(),
6162 .stack_check = false,6163 .stack_check = false,
6163 .stack_protector = 0,6164 .stack_protector = 0,
...@@ -6269,6 +6270,7 @@ pub fn build_crt_file(...@@ -6269,6 +6270,7 @@ pub fn build_crt_file(
6269 },6270 },
6270 .fully_qualified_name = "root",6271 .fully_qualified_name = "root",
6271 .inherited = .{6272 .inherited = .{
6273 .resolved_target = comp.root_mod.resolved_target,
6272 .strip = comp.compilerRtStrip(),6274 .strip = comp.compilerRtStrip(),
6273 .stack_check = false,6275 .stack_check = false,
6274 .stack_protector = 0,6276 .stack_protector = 0,
src/glibc.zig+48-20
...@@ -12,7 +12,7 @@ const Compilation = @import("Compilation.zig");...@@ -12,7 +12,7 @@ const Compilation = @import("Compilation.zig");
12const build_options = @import("build_options");12const build_options = @import("build_options");
13const trace = @import("tracy.zig").trace;13const trace = @import("tracy.zig").trace;
14const Cache = std.Build.Cache;14const Cache = std.Build.Cache;
15const Package = @import("Package.zig");15const Module = @import("Package/Module.zig");
1616
17pub const Lib = struct {17pub const Lib = struct {
18 name: []const u8,18 name: []const u8,
...@@ -1067,34 +1067,62 @@ fn buildSharedLib(...@@ -1067,34 +1067,62 @@ fn buildSharedLib(
1067 .src_path = try path.join(arena, &[_][]const u8{ bin_directory.path.?, asm_file_basename }),1067 .src_path = try path.join(arena, &[_][]const u8{ bin_directory.path.?, asm_file_basename }),
1068 },1068 },
1069 };1069 };
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
1070 const sub_compilation = try Compilation.create(comp.gpa, .{1111 const sub_compilation = try Compilation.create(comp.gpa, .{
1071 .local_cache_directory = zig_cache_directory,1112 .local_cache_directory = zig_cache_directory,
1072 .global_cache_directory = comp.global_cache_directory,1113 .global_cache_directory = comp.global_cache_directory,
1073 .zig_lib_directory = comp.zig_lib_directory,1114 .zig_lib_directory = comp.zig_lib_directory,
1115 .thread_pool = comp.thread_pool,
1116 .self_exe_path = comp.self_exe_path,
1074 .cache_mode = .whole,1117 .cache_mode = .whole,
1075 .target = comp.getTarget(),1118 .config = config,
1119 .root_mod = root_mod,
1076 .root_name = lib.name,1120 .root_name = lib.name,
1077 .main_mod = null,1121 .libc_installation = comp.libc_installation,
1078 .output_mode = .Lib,
1079 .link_mode = .Dynamic,
1080 .thread_pool = comp.thread_pool,
1081 .libc_installation = comp.bin_file.options.libc_installation,
1082 .emit_bin = emit_bin,1122 .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,
1091 .emit_h = null,1123 .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,
1096 .verbose_cc = comp.verbose_cc,1124 .verbose_cc = comp.verbose_cc,
1097 .verbose_link = comp.bin_file.options.verbose_link,1125 .verbose_link = comp.verbose_link,
1098 .verbose_air = comp.verbose_air,1126 .verbose_air = comp.verbose_air,
1099 .verbose_llvm_ir = comp.verbose_llvm_ir,1127 .verbose_llvm_ir = comp.verbose_llvm_ir,
1100 .verbose_llvm_bc = comp.verbose_llvm_bc,1128 .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 {...@@ -251,6 +251,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void {
251 },251 },
252 .fully_qualified_name = "root",252 .fully_qualified_name = "root",
253 .inherited = .{253 .inherited = .{
254 .resolved_target = comp.root_mod.resolved_target,
254 .strip = strip,255 .strip = strip,
255 .stack_check = false,256 .stack_check = false,
256 .stack_protector = 0,257 .stack_protector = 0,
...@@ -439,6 +440,7 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void {...@@ -439,6 +440,7 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void {
439 },440 },
440 .fully_qualified_name = "root",441 .fully_qualified_name = "root",
441 .inherited = .{442 .inherited = .{
443 .resolved_target = comp.root_mod.resolved_target,
442 .strip = strip,444 .strip = strip,
443 .stack_check = false,445 .stack_check = false,
444 .stack_protector = 0,446 .stack_protector = 0,
src/libtsan.zig+1
...@@ -219,6 +219,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {...@@ -219,6 +219,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void {
219 },219 },
220 .fully_qualified_name = "root",220 .fully_qualified_name = "root",
221 .inherited = .{221 .inherited = .{
222 .resolved_target = comp.root_mod.resolved_target,
222 .strip = strip,223 .strip = strip,
223 .stack_check = false,224 .stack_check = false,
224 .stack_protector = 0,225 .stack_protector = 0,
src/libunwind.zig+1
...@@ -40,6 +40,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void {...@@ -40,6 +40,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void {
40 },40 },
41 .fully_qualified_name = "root",41 .fully_qualified_name = "root",
42 .inherited = .{42 .inherited = .{
43 .resolved_target = comp.root_mod.resolved_target,
43 .strip = comp.compilerRtStrip(),44 .strip = comp.compilerRtStrip(),
44 .stack_check = false,45 .stack_check = false,
45 .stack_protector = 0,46 .stack_protector = 0,
src/musl.zig+1
...@@ -222,6 +222,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr...@@ -222,6 +222,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
222 },222 },
223 .fully_qualified_name = "root",223 .fully_qualified_name = "root",
224 .inherited = .{224 .inherited = .{
225 .resolved_target = comp.root_mod.resolved_target,
225 .strip = strip,226 .strip = strip,
226 .stack_check = false,227 .stack_check = false,
227 .stack_protector = 0,228 .stack_protector = 0,