authorgravatar for tristan.ross@midstall.comTristan Ross <tristan.ross@midstall.com> 2024-02-18 20:34:32-08:00
committergravatar for tristan.ross@midstall.comTristan Ross <tristan.ross@midstall.com> 2024-03-11 07:09:10-07:00
log9d70d614ae33133f3786ec056b8660476ff49f53
tree61c46c488ae72d9ea9e96f25b661dc8d374abe5f
parent099f3c4039d5702b073639ef8b55881973b71c80
signaturelock-open Commit is signed but in an unrecognized format.

std.builtin: make link mode fields lowercase


35 files changed, 159 insertions(+), 164 deletions(-)

build.zig+1-1
......@@ -855,7 +855,7 @@ fn addCMakeLibraryList(exe: *std.Build.Step.Compile, list: []const u8) void {
855855}
856856
857857const CMakeConfig = struct {
858 llvm_linkage: std.Build.Step.Compile.Linkage,
858 llvm_linkage: std.builtin.LinkMode,
859859 cmake_binary_dir: []const u8,
860860 cmake_prefix_path: []const u8,
861861 cmake_static_library_prefix: []const u8,
lib/c.zig+10-10
......@@ -26,7 +26,7 @@ const is_freestanding = switch (native_os) {
2626
2727comptime {
2828 if (is_freestanding and is_wasm and builtin.link_libc) {
29 @export(wasm_start, .{ .name = "_start", .linkage = .Strong });
29 @export(wasm_start, .{ .name = "_start", .linkage = .strong });
3030 }
3131
3232 if (native_os == .linux) {
......@@ -34,16 +34,16 @@ comptime {
3434 }
3535
3636 if (builtin.link_libc) {
37 @export(strcmp, .{ .name = "strcmp", .linkage = .Strong });
38 @export(strncmp, .{ .name = "strncmp", .linkage = .Strong });
39 @export(strerror, .{ .name = "strerror", .linkage = .Strong });
40 @export(strlen, .{ .name = "strlen", .linkage = .Strong });
41 @export(strcpy, .{ .name = "strcpy", .linkage = .Strong });
42 @export(strncpy, .{ .name = "strncpy", .linkage = .Strong });
43 @export(strcat, .{ .name = "strcat", .linkage = .Strong });
44 @export(strncat, .{ .name = "strncat", .linkage = .Strong });
37 @export(strcmp, .{ .name = "strcmp", .linkage = .strong });
38 @export(strncmp, .{ .name = "strncmp", .linkage = .strong });
39 @export(strerror, .{ .name = "strerror", .linkage = .strong });
40 @export(strlen, .{ .name = "strlen", .linkage = .strong });
41 @export(strcpy, .{ .name = "strcpy", .linkage = .strong });
42 @export(strncpy, .{ .name = "strncpy", .linkage = .strong });
43 @export(strcat, .{ .name = "strcat", .linkage = .strong });
44 @export(strncat, .{ .name = "strncat", .linkage = .strong });
4545 } else if (is_msvc) {
46 @export(_fltused, .{ .name = "_fltused", .linkage = .Strong });
46 @export(_fltused, .{ .name = "_fltused", .linkage = .strong });
4747 }
4848}
4949
lib/compiler_rt/os_version_check.zig+1-1
......@@ -1,7 +1,7 @@
11const std = @import("std");
22const testing = std.testing;
33const builtin = @import("builtin");
4const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
4const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .weak;
55const panic = @import("common.zig").panic;
66
77const have_availability_version_check = builtin.os.tag.isDarwin() and
lib/compiler_rt/stack_probe.zig+2-2
......@@ -8,8 +8,8 @@ const is_test = builtin.is_test;
88const is_gnu = abi.isGnu();
99const is_mingw = os_tag == .windows and is_gnu;
1010
11const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak;
12const strong_linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Strong;
11const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .weak;
12const strong_linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .internal else .strong;
1313pub const panic = @import("common.zig").panic;
1414
1515comptime {
lib/std/Build.zig+1-1
......@@ -645,7 +645,7 @@ pub const ExecutableOptions = struct {
645645 version: ?std.SemanticVersion = null,
646646 optimize: std.builtin.OptimizeMode = .Debug,
647647 code_model: std.builtin.CodeModel = .default,
648 linkage: ?Step.Compile.Linkage = null,
648 linkage: ?std.builtin.LinkMode = null,
649649 max_rss: usize = 0,
650650 link_libc: ?bool = null,
651651 single_threaded: ?bool = null,
lib/std/Build/Module.zig+1-1
......@@ -414,7 +414,7 @@ pub const LinkSystemLibraryOptions = struct {
414414 needed: bool = false,
415415 weak: bool = false,
416416 use_pkg_config: SystemLib.UsePkgConfig = .yes,
417 preferred_link_mode: std.builtin.LinkMode = .Dynamic,
417 preferred_link_mode: std.builtin.LinkMode = .dynamic,
418418 search_strategy: SystemLib.SearchStrategy = .paths_first,
419419};
420420
lib/std/Build/Step/Compile.zig+13-18
......@@ -28,7 +28,7 @@ linker_script: ?LazyPath = null,
2828version_script: ?LazyPath = null,
2929out_filename: []const u8,
3030out_lib_filename: []const u8,
31linkage: ?Linkage = null,
31linkage: ?std.builtin.LinkMode = null,
3232version: ?std.SemanticVersion,
3333kind: Kind,
3434major_only_filename: ?[]const u8,
......@@ -223,7 +223,7 @@ pub const Options = struct {
223223 name: []const u8,
224224 root_module: Module.CreateOptions,
225225 kind: Kind,
226 linkage: ?Linkage = null,
226 linkage: ?std.builtin.LinkMode = null,
227227 version: ?std.SemanticVersion = null,
228228 max_rss: usize = 0,
229229 filters: []const []const u8 = &.{},
......@@ -246,8 +246,6 @@ pub const Kind = enum {
246246 @"test",
247247};
248248
249pub const Linkage = enum { dynamic, static };
250
251249pub fn create(owner: *std.Build, options: Options) *Compile {
252250 const name = owner.dupe(options.name);
253251 if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) {
......@@ -283,10 +281,7 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
283281 .obj => .Obj,
284282 .exe, .@"test" => .Exe,
285283 },
286 .link_mode = if (options.linkage) |some| @as(std.builtin.LinkMode, switch (some) {
287 .dynamic => .Dynamic,
288 .static => .Static,
289 }) else null,
284 .link_mode = options.linkage,
290285 .version = options.version,
291286 }) catch @panic("OOM");
292287
......@@ -531,11 +526,11 @@ pub fn dependsOnSystemLibrary(self: *const Compile, name: []const u8) bool {
531526}
532527
533528pub fn isDynamicLibrary(self: *const Compile) bool {
534 return self.kind == .lib and self.linkage == Linkage.dynamic;
529 return self.kind == .lib and self.linkage == .dynamic;
535530}
536531
537532pub fn isStaticLibrary(self: *const Compile) bool {
538 return self.kind == .lib and self.linkage != Linkage.dynamic;
533 return self.kind == .lib and self.linkage != .dynamic;
539534}
540535
541536pub fn producesPdbFile(self: *Compile) bool {
......@@ -988,7 +983,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
988983 var prev_has_cflags = false;
989984 var prev_has_rcflags = false;
990985 var prev_search_strategy: Module.SystemLib.SearchStrategy = .paths_first;
991 var prev_preferred_link_mode: std.builtin.LinkMode = .Dynamic;
986 var prev_preferred_link_mode: std.builtin.LinkMode = .dynamic;
992987 // Track the number of positional arguments so that a nice error can be
993988 // emitted if there is nothing to link.
994989 var total_linker_objects: usize = @intFromBool(self.root_module.root_source_file != null);
......@@ -1053,16 +1048,16 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
10531048 {
10541049 switch (system_lib.search_strategy) {
10551050 .no_fallback => switch (system_lib.preferred_link_mode) {
1056 .Dynamic => try zig_args.append("-search_dylibs_only"),
1057 .Static => try zig_args.append("-search_static_only"),
1051 .dynamic => try zig_args.append("-search_dylibs_only"),
1052 .static => try zig_args.append("-search_static_only"),
10581053 },
10591054 .paths_first => switch (system_lib.preferred_link_mode) {
1060 .Dynamic => try zig_args.append("-search_paths_first"),
1061 .Static => try zig_args.append("-search_paths_first_static"),
1055 .dynamic => try zig_args.append("-search_paths_first"),
1056 .static => try zig_args.append("-search_paths_first_static"),
10621057 },
10631058 .mode_first => switch (system_lib.preferred_link_mode) {
1064 .Dynamic => try zig_args.append("-search_dylibs_first"),
1065 .Static => try zig_args.append("-search_static_first"),
1059 .dynamic => try zig_args.append("-search_dylibs_first"),
1060 .static => try zig_args.append("-search_static_first"),
10661061 },
10671062 }
10681063 prev_search_strategy = system_lib.search_strategy;
......@@ -1138,7 +1133,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
11381133 try zig_args.append(full_path_lib);
11391134 total_linker_objects += 1;
11401135
1141 if (other.linkage == Linkage.dynamic and
1136 if (other.linkage == .dynamic and
11421137 self.rootModuleTarget().os.tag != .windows)
11431138 {
11441139 if (fs.path.dirname(full_path_lib)) |dirname| {
lib/std/Build/Step/TranslateC.zig+1-1
......@@ -55,7 +55,7 @@ pub const AddExecutableOptions = struct {
5555 version: ?std.SemanticVersion = null,
5656 target: ?std.Build.ResolvedTarget = null,
5757 optimize: ?std.builtin.OptimizeMode = null,
58 linkage: ?Step.Compile.Linkage = null,
58 linkage: ?std.builtin.LinkMode = null,
5959};
6060
6161pub fn getOutput(self: *TranslateC) std.Build.LazyPath {
lib/std/builtin.zig+2-2
......@@ -500,8 +500,8 @@ pub const OutputMode = enum {
500500/// This data structure is used by the Zig language code generation and
501501/// therefore must be kept in sync with the compiler implementation.
502502pub const LinkMode = enum {
503 Static,
504 Dynamic,
503 static,
504 dynamic,
505505};
506506
507507/// This data structure is used by the Zig language code generation and
lib/std/c/darwin.zig+1-1
......@@ -202,7 +202,7 @@ var dummy_execute_header: mach_hdr = undefined;
202202pub extern var _mh_execute_header: mach_hdr;
203203comptime {
204204 if (builtin.target.isDarwin()) {
205 @export(dummy_execute_header, .{ .name = "_mh_execute_header", .linkage = .Weak });
205 @export(dummy_execute_header, .{ .name = "_mh_execute_header", .linkage = .weak });
206206 }
207207}
208208
lib/std/dynamic_library.zig+1-1
......@@ -56,7 +56,7 @@ const RDebug = extern struct {
5656/// TODO make it possible to reference this same external symbol 2x so we don't need this
5757/// helper function.
5858pub fn get_DYNAMIC() ?[*]elf.Dyn {
59 return @extern([*]elf.Dyn, .{ .name = "_DYNAMIC", .linkage = .Weak });
59 return @extern([*]elf.Dyn, .{ .name = "_DYNAMIC", .linkage = .weak });
6060}
6161
6262pub fn linkmap_iterator(phdrs: []elf.Phdr) !LinkMap.Iterator {
lib/std/os/linux.zig+1-1
......@@ -394,7 +394,7 @@ const extern_getauxval = switch (builtin.zig_backend) {
394394
395395comptime {
396396 if (extern_getauxval) {
397 @export(getauxvalImpl, .{ .name = "getauxval", .linkage = .Weak });
397 @export(getauxvalImpl, .{ .name = "getauxval", .linkage = .weak });
398398 }
399399}
400400
lib/std/start.zig+1-1
......@@ -50,7 +50,7 @@ comptime {
5050 }
5151 }
5252 } else {
53 if (builtin.output_mode == .Lib and builtin.link_mode == .Dynamic) {
53 if (builtin.output_mode == .Lib and builtin.link_mode == .dynamic) {
5454 if (native_os == .windows and !@hasDecl(root, "_DllMainCRTStartup")) {
5555 @export(_DllMainCRTStartup, .{ .name = "_DllMainCRTStartup" });
5656 }
lib/std/zig.zig+12-12
......@@ -155,9 +155,9 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
155155 .coff => switch (options.output_mode) {
156156 .Exe => return std.fmt.allocPrint(allocator, "{s}{s}", .{ root_name, t.exeFileExt() }),
157157 .Lib => {
158 const suffix = switch (options.link_mode orelse .Static) {
159 .Static => ".lib",
160 .Dynamic => ".dll",
158 const suffix = switch (options.link_mode orelse .static) {
159 .static => ".lib",
160 .dynamic => ".dll",
161161 };
162162 return std.fmt.allocPrint(allocator, "{s}{s}", .{ root_name, suffix });
163163 },
......@@ -166,11 +166,11 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
166166 .elf => switch (options.output_mode) {
167167 .Exe => return allocator.dupe(u8, root_name),
168168 .Lib => {
169 switch (options.link_mode orelse .Static) {
170 .Static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
169 switch (options.link_mode orelse .static) {
170 .static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
171171 t.libPrefix(), root_name,
172172 }),
173 .Dynamic => {
173 .dynamic => {
174174 if (options.version) |ver| {
175175 return std.fmt.allocPrint(allocator, "{s}{s}.so.{d}.{d}.{d}", .{
176176 t.libPrefix(), root_name, ver.major, ver.minor, ver.patch,
......@@ -188,11 +188,11 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
188188 .macho => switch (options.output_mode) {
189189 .Exe => return allocator.dupe(u8, root_name),
190190 .Lib => {
191 switch (options.link_mode orelse .Static) {
192 .Static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
191 switch (options.link_mode orelse .static) {
192 .static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
193193 t.libPrefix(), root_name,
194194 }),
195 .Dynamic => {
195 .dynamic => {
196196 if (options.version) |ver| {
197197 return std.fmt.allocPrint(allocator, "{s}{s}.{d}.{d}.{d}.dylib", .{
198198 t.libPrefix(), root_name, ver.major, ver.minor, ver.patch,
......@@ -210,11 +210,11 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
210210 .wasm => switch (options.output_mode) {
211211 .Exe => return std.fmt.allocPrint(allocator, "{s}{s}", .{ root_name, t.exeFileExt() }),
212212 .Lib => {
213 switch (options.link_mode orelse .Static) {
214 .Static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
213 switch (options.link_mode orelse .static) {
214 .static => return std.fmt.allocPrint(allocator, "{s}{s}.a", .{
215215 t.libPrefix(), root_name,
216216 }),
217 .Dynamic => return std.fmt.allocPrint(allocator, "{s}.wasm", .{root_name}),
217 .dynamic => return std.fmt.allocPrint(allocator, "{s}.wasm", .{root_name}),
218218 }
219219 },
220220 .Obj => return std.fmt.allocPrint(allocator, "{s}.o", .{root_name}),
src/Compilation.zig+6-6
......@@ -1201,7 +1201,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
12011201 const output_mode = options.config.output_mode;
12021202 const is_dyn_lib = switch (output_mode) {
12031203 .Obj, .Exe => false,
1204 .Lib => options.config.link_mode == .Dynamic,
1204 .Lib => options.config.link_mode == .dynamic,
12051205 };
12061206 const is_exe_or_dyn_lib = switch (output_mode) {
12071207 .Obj => false,
......@@ -1806,8 +1806,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
18061806 .{ .musl_crt_file = .scrt1_o },
18071807 .{ .musl_crt_file = .rcrt1_o },
18081808 switch (comp.config.link_mode) {
1809 .Static => .{ .musl_crt_file = .libc_a },
1810 .Dynamic => .{ .musl_crt_file = .libc_so },
1809 .static => .{ .musl_crt_file = .libc_a },
1810 .dynamic => .{ .musl_crt_file = .libc_so },
18111811 },
18121812 });
18131813 }
......@@ -6087,7 +6087,7 @@ pub fn get_libc_crt_file(comp: *Compilation, arena: Allocator, basename: []const
60876087fn wantBuildLibCFromSource(comp: Compilation) bool {
60886088 const is_exe_or_dyn_lib = switch (comp.config.output_mode) {
60896089 .Obj => false,
6090 .Lib => comp.config.link_mode == .Dynamic,
6090 .Lib => comp.config.link_mode == .dynamic,
60916091 .Exe => true,
60926092 };
60936093 const ofmt = comp.root_mod.resolved_target.result.ofmt;
......@@ -6116,7 +6116,7 @@ fn wantBuildMinGWFromSource(comp: Compilation) bool {
61166116fn wantBuildLibUnwindFromSource(comp: *Compilation) bool {
61176117 const is_exe_or_dyn_lib = switch (comp.config.output_mode) {
61186118 .Obj => false,
6119 .Lib => comp.config.link_mode == .Dynamic,
6119 .Lib => comp.config.link_mode == .dynamic,
61206120 .Exe => true,
61216121 };
61226122 const ofmt = comp.root_mod.resolved_target.result.ofmt;
......@@ -6310,7 +6310,7 @@ fn buildOutputFromZig(
63106310
63116311 const config = try Config.resolve(.{
63126312 .output_mode = output_mode,
6313 .link_mode = .Static,
6313 .link_mode = .static,
63146314 .resolved_target = comp.root_mod.resolved_target,
63156315 .is_test = false,
63166316 .have_zcu = true,
src/Compilation/Config.zig+12-12
......@@ -348,26 +348,26 @@ pub fn resolve(options: Options) ResolveError!Config {
348348 const link_mode = b: {
349349 const explicitly_exe_or_dyn_lib = switch (options.output_mode) {
350350 .Obj => false,
351 .Lib => (options.link_mode orelse .Static) == .Dynamic,
351 .Lib => (options.link_mode orelse .static) == .dynamic,
352352 .Exe => true,
353353 };
354354
355355 if (target_util.cannotDynamicLink(target)) {
356 if (options.link_mode == .Dynamic) return error.TargetCannotDynamicLink;
357 break :b .Static;
356 if (options.link_mode == .dynamic) return error.TargetCannotDynamicLink;
357 break :b .static;
358358 }
359359 if (explicitly_exe_or_dyn_lib and link_libc and
360360 (target.isGnuLibC() or target_util.osRequiresLibC(target)))
361361 {
362 if (options.link_mode == .Static) return error.LibCRequiresDynamicLinking;
363 break :b .Dynamic;
362 if (options.link_mode == .static) return error.LibCRequiresDynamicLinking;
363 break :b .dynamic;
364364 }
365365 // When creating a executable that links to system libraries, we
366366 // require dynamic linking, but we must not link static libraries
367367 // or object files dynamically!
368368 if (options.any_dyn_libs and options.output_mode == .Exe) {
369 if (options.link_mode == .Static) return error.SharedLibrariesRequireDynamicLinking;
370 break :b .Dynamic;
369 if (options.link_mode == .static) return error.SharedLibrariesRequireDynamicLinking;
370 break :b .dynamic;
371371 }
372372
373373 if (options.link_mode) |link_mode| break :b link_mode;
......@@ -377,16 +377,16 @@ pub fn resolve(options: Options) ResolveError!Config {
377377 {
378378 // If targeting the system's native ABI and the system's libc is
379379 // musl, link dynamically by default.
380 break :b .Dynamic;
380 break :b .dynamic;
381381 }
382382
383383 // Static is generally a better default. Fight me.
384 break :b .Static;
384 break :b .static;
385385 };
386386
387387 const import_memory = options.import_memory orelse (options.output_mode == .Obj);
388388 const export_memory = b: {
389 if (link_mode == .Dynamic) {
389 if (link_mode == .dynamic) {
390390 if (options.export_memory == true) return error.ExportMemoryAndDynamicIncompatible;
391391 break :b false;
392392 }
......@@ -397,7 +397,7 @@ pub fn resolve(options: Options) ResolveError!Config {
397397 const pie: bool = b: {
398398 switch (options.output_mode) {
399399 .Obj, .Exe => {},
400 .Lib => if (link_mode == .Dynamic) {
400 .Lib => if (link_mode == .dynamic) {
401401 if (options.pie == true) return error.DynamicLibraryPrecludesPie;
402402 break :b false;
403403 },
......@@ -467,7 +467,7 @@ pub fn resolve(options: Options) ResolveError!Config {
467467 if (rdynamic) break :b true;
468468 break :b switch (options.output_mode) {
469469 .Obj, .Exe => false,
470 .Lib => link_mode == .Dynamic,
470 .Lib => link_mode == .dynamic,
471471 };
472472 };
473473
src/Package/Module.zig+1-1
......@@ -178,7 +178,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module {
178178 return error.PieRequiresPic;
179179 break :b true;
180180 }
181 if (options.global.link_mode == .Dynamic) {
181 if (options.global.link_mode == .dynamic) {
182182 if (options.inherited.pic == false)
183183 return error.DynamicLinkingRequiresPic;
184184 break :b true;
src/arch/x86_64/Emit.zig+2-2
......@@ -110,7 +110,7 @@ pub fn emitMir(emit: *Emit) Error!void {
110110 const is_obj_or_static_lib = switch (emit.lower.output_mode) {
111111 .Exe => false,
112112 .Obj => true,
113 .Lib => emit.lower.link_mode == .Static,
113 .Lib => emit.lower.link_mode == .static,
114114 };
115115 const atom = elf_file.symbol(data.atom_index).atom(elf_file).?;
116116 const sym_index = elf_file.zigObjectPtr().?.symbol(data.sym_index);
......@@ -158,7 +158,7 @@ pub fn emitMir(emit: *Emit) Error!void {
158158 const is_obj_or_static_lib = switch (emit.lower.output_mode) {
159159 .Exe => false,
160160 .Obj => true,
161 .Lib => emit.lower.link_mode == .Static,
161 .Lib => emit.lower.link_mode == .static,
162162 };
163163 const atom = macho_file.getSymbol(data.atom_index).getAtom(macho_file).?;
164164 const sym_index = macho_file.getZigObject().?.symbols.items[data.sym_index];
src/arch/x86_64/Lower.zig+1-1
......@@ -329,7 +329,7 @@ fn emit(lower: *Lower, prefix: Prefix, mnemonic: Mnemonic, ops: []const Operand)
329329 const is_obj_or_static_lib = switch (lower.output_mode) {
330330 .Exe => false,
331331 .Obj => true,
332 .Lib => lower.link_mode == .Static,
332 .Lib => lower.link_mode == .static,
333333 };
334334
335335 const emit_prefix = prefix;
src/glibc.zig+1-1
......@@ -1084,7 +1084,7 @@ fn buildSharedLib(
10841084 const strip = comp.compilerRtStrip();
10851085 const config = try Compilation.Config.resolve(.{
10861086 .output_mode = .Lib,
1087 .link_mode = .Dynamic,
1087 .link_mode = .dynamic,
10881088 .resolved_target = comp.root_mod.resolved_target,
10891089 .is_test = false,
10901090 .have_zcu = false,
src/libcxx.zig+2-2
......@@ -115,7 +115,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void {
115115
116116 const root_name = "c++";
117117 const output_mode = .Lib;
118 const link_mode = .Static;
118 const link_mode = .static;
119119 const target = comp.root_mod.resolved_target.result;
120120 const basename = try std.zig.binNameAlloc(arena, .{
121121 .root_name = root_name,
......@@ -327,7 +327,7 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void {
327327
328328 const root_name = "c++abi";
329329 const output_mode = .Lib;
330 const link_mode = .Static;
330 const link_mode = .static;
331331 const target = comp.root_mod.resolved_target.result;
332332 const basename = try std.zig.binNameAlloc(arena, .{
333333 .root_name = root_name,
src/libtsan.zig+1-1
......@@ -27,7 +27,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) BuildError!v
2727
2828 const root_name = "tsan";
2929 const output_mode = .Lib;
30 const link_mode = .Static;
30 const link_mode = .static;
3131 const target = comp.getTarget();
3232 const basename = try std.zig.binNameAlloc(arena, .{
3333 .root_name = root_name,
src/libunwind.zig+1-1
......@@ -62,7 +62,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void {
6262 });
6363
6464 const root_name = "unwind";
65 const link_mode = .Static;
65 const link_mode = .static;
6666 const target = comp.root_mod.resolved_target.result;
6767 const basename = try std.zig.binNameAlloc(arena, .{
6868 .root_name = root_name,
src/link.zig+6-6
......@@ -287,8 +287,8 @@ pub const File = struct {
287287 switch (output_mode) {
288288 .Obj => return,
289289 .Lib => switch (link_mode) {
290 .Static => return,
291 .Dynamic => {},
290 .static => return,
291 .dynamic => {},
292292 },
293293 .Exe => {},
294294 }
......@@ -582,7 +582,7 @@ pub const File = struct {
582582 const use_lld = build_options.have_llvm and comp.config.use_lld;
583583 const output_mode = comp.config.output_mode;
584584 const link_mode = comp.config.link_mode;
585 if (use_lld and output_mode == .Lib and link_mode == .Static) {
585 if (use_lld and output_mode == .Lib and link_mode == .static) {
586586 return base.linkAsArchive(arena, prog_node);
587587 }
588588 switch (base.tag) {
......@@ -957,8 +957,8 @@ pub const File = struct {
957957 const executable_mode = if (builtin.target.os.tag == .windows) 0 else 0o777;
958958 switch (effectiveOutputMode(use_lld, output_mode)) {
959959 .Lib => return switch (link_mode) {
960 .Dynamic => executable_mode,
961 .Static => fs.File.default_mode,
960 .dynamic => executable_mode,
961 .static => fs.File.default_mode,
962962 },
963963 .Exe => return executable_mode,
964964 .Obj => return fs.File.default_mode,
......@@ -966,7 +966,7 @@ pub const File = struct {
966966 }
967967
968968 pub fn isStatic(self: File) bool {
969 return self.comp.config.link_mode == .Static;
969 return self.comp.config.link_mode == .static;
970970 }
971971
972972 pub fn isObject(self: File) bool {
src/link/Coff.zig+1-1
......@@ -2275,7 +2275,7 @@ fn writeHeader(self: *Coff) !void {
22752275 .p32 => flags.@"32BIT_MACHINE" = 1,
22762276 .p64 => flags.LARGE_ADDRESS_AWARE = 1,
22772277 }
2278 if (self.base.comp.config.output_mode == .Lib and self.base.comp.config.link_mode == .Dynamic) {
2278 if (self.base.comp.config.output_mode == .Lib and self.base.comp.config.link_mode == .dynamic) {
22792279 flags.DLL = 1;
22802280 }
22812281
src/link/Coff/lld.zig+5-5
......@@ -45,7 +45,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node)
4545 defer sub_prog_node.end();
4646
4747 const is_lib = comp.config.output_mode == .Lib;
48 const is_dyn_lib = comp.config.link_mode == .Dynamic and is_lib;
48 const is_dyn_lib = comp.config.link_mode == .dynamic and is_lib;
4949 const is_exe_or_dyn_lib = is_dyn_lib or comp.config.output_mode == .Exe;
5050 const link_in_crt = comp.config.link_libc and is_exe_or_dyn_lib;
5151 const target = comp.root_mod.resolved_target.result;
......@@ -411,16 +411,16 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node)
411411 try argv.append(try comp.get_libc_crt_file(arena, "mingwex.lib"));
412412 } else {
413413 const lib_str = switch (comp.config.link_mode) {
414 .Dynamic => "",
415 .Static => "lib",
414 .dynamic => "",
415 .static => "lib",
416416 };
417417 const d_str = switch (optimize_mode) {
418418 .Debug => "d",
419419 else => "",
420420 };
421421 switch (comp.config.link_mode) {
422 .Static => try argv.append(try allocPrint(arena, "libcmt{s}.lib", .{d_str})),
423 .Dynamic => try argv.append(try allocPrint(arena, "msvcrt{s}.lib", .{d_str})),
422 .static => try argv.append(try allocPrint(arena, "libcmt{s}.lib", .{d_str})),
423 .dynamic => try argv.append(try allocPrint(arena, "msvcrt{s}.lib", .{d_str})),
424424 }
425425
426426 try argv.append(try allocPrint(arena, "{s}vcruntime{s}.lib", .{ lib_str, d_str }));
src/link/Elf.zig+26-26
......@@ -262,7 +262,7 @@ pub fn createEmpty(
262262 .sparc64 => 0x2000,
263263 else => 0x1000,
264264 };
265 const is_dyn_lib = output_mode == .Lib and link_mode == .Dynamic;
265 const is_dyn_lib = output_mode == .Lib and link_mode == .dynamic;
266266 const default_sym_version: elf.Elf64_Versym = if (is_dyn_lib or comp.config.rdynamic)
267267 elf.VER_NDX_GLOBAL
268268 else
......@@ -349,7 +349,7 @@ pub fn createEmpty(
349349 }
350350
351351 const is_obj = output_mode == .Obj;
352 const is_obj_or_ar = is_obj or (output_mode == .Lib and link_mode == .Static);
352 const is_obj_or_ar = is_obj or (output_mode == .Lib and link_mode == .static);
353353
354354 // What path should this ELF linker code output to?
355355 // If using LLD to link, this code should produce an object file so that it
......@@ -1180,10 +1180,10 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node)
11801180
11811181 success: {
11821182 if (!self.base.isStatic()) {
1183 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .Dynamic))
1183 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .dynamic))
11841184 break :success;
11851185 }
1186 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .Static))
1186 if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .static))
11871187 break :success;
11881188
11891189 try self.reportMissingLibraryError(
......@@ -1211,8 +1211,8 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node)
12111211 });
12121212 } else if (target.isMusl()) {
12131213 const path = try comp.get_libc_crt_file(arena, switch (link_mode) {
1214 .Static => "libc.a",
1215 .Dynamic => "libc.so",
1214 .static => "libc.a",
1215 .dynamic => "libc.so",
12161216 });
12171217 try system_libs.append(.{ .path = path });
12181218 } else {
......@@ -1628,7 +1628,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
16281628 // libc dep
16291629 if (comp.config.link_libc) {
16301630 if (self.base.comp.libc_installation != null) {
1631 const needs_grouping = link_mode == .Static;
1631 const needs_grouping = link_mode == .static;
16321632 if (needs_grouping) try argv.append("--start-group");
16331633 try argv.appendSlice(target_util.libcFullLinkFlags(target));
16341634 if (needs_grouping) try argv.append("--end-group");
......@@ -1642,8 +1642,8 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
16421642 try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a"));
16431643 } else if (target.isMusl()) {
16441644 try argv.append(try comp.get_libc_crt_file(arena, switch (link_mode) {
1645 .Static => "libc.a",
1646 .Dynamic => "libc.so",
1645 .static => "libc.a",
1646 .dynamic => "libc.so",
16471647 }));
16481648 }
16491649 }
......@@ -1797,10 +1797,10 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {
17971797 // Maybe we should hoist search-strategy all the way here?
17981798 for (self.lib_dirs) |lib_dir| {
17991799 if (!self.base.isStatic()) {
1800 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .Dynamic))
1800 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .dynamic))
18011801 break :success;
18021802 }
1803 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .Static))
1803 if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .static))
18041804 break :success;
18051805 }
18061806 } else {
......@@ -1858,8 +1858,8 @@ fn accessLibPath(
18581858 test_path.clearRetainingCapacity();
18591859 const prefix = if (link_mode != null) "lib" else "";
18601860 const suffix = if (link_mode) |mode| switch (mode) {
1861 .Static => target.staticLibSuffix(),
1862 .Dynamic => target.dynamicLibSuffix(),
1861 .static => target.staticLibSuffix(),
1862 .dynamic => target.dynamicLibSuffix(),
18631863 } else "";
18641864 try test_path.writer().print("{s}" ++ sep ++ "{s}{s}{s}", .{
18651865 lib_dir_path,
......@@ -2150,10 +2150,10 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
21502150 const is_obj = output_mode == .Obj;
21512151 const is_lib = output_mode == .Lib;
21522152 const link_mode = comp.config.link_mode;
2153 const is_dyn_lib = link_mode == .Dynamic and is_lib;
2153 const is_dyn_lib = link_mode == .dynamic and is_lib;
21542154 const is_exe_or_dyn_lib = is_dyn_lib or output_mode == .Exe;
21552155 const have_dynamic_linker = comp.config.link_libc and
2156 link_mode == .Dynamic and is_exe_or_dyn_lib;
2156 link_mode == .dynamic and is_exe_or_dyn_lib;
21572157 const target = comp.root_mod.resolved_target.result;
21582158 const compiler_rt_path: ?[]const u8 = blk: {
21592159 if (comp.compiler_rt_lib) |x| break :blk x.full_object_path;
......@@ -2463,7 +2463,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
24632463 try argv.append(arg);
24642464 }
24652465
2466 if (link_mode == .Static) {
2466 if (link_mode == .static) {
24672467 if (target.cpu.arch.isArmOrThumb()) {
24682468 try argv.append("-Bstatic");
24692469 } else {
......@@ -2647,7 +2647,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
26472647 comp.link_error_flags.missing_libc = false;
26482648 if (comp.config.link_libc) {
26492649 if (comp.libc_installation != null) {
2650 const needs_grouping = link_mode == .Static;
2650 const needs_grouping = link_mode == .static;
26512651 if (needs_grouping) try argv.append("--start-group");
26522652 try argv.appendSlice(target_util.libcFullLinkFlags(target));
26532653 if (needs_grouping) try argv.append("--end-group");
......@@ -2661,8 +2661,8 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
26612661 try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a"));
26622662 } else if (target.isMusl()) {
26632663 try argv.append(try comp.get_libc_crt_file(arena, switch (link_mode) {
2664 .Static => "libc.a",
2665 .Dynamic => "libc.so",
2664 .static => "libc.a",
2665 .dynamic => "libc.so",
26662666 }));
26672667 } else {
26682668 comp.link_error_flags.missing_libc = true;
......@@ -2928,8 +2928,8 @@ pub fn writeElfHeader(self: *Elf) !void {
29282928 .Exe => if (comp.config.pie) .DYN else .EXEC,
29292929 .Obj => .REL,
29302930 .Lib => switch (link_mode) {
2931 .Static => @as(elf.ET, .REL),
2932 .Dynamic => .DYN,
2931 .static => @as(elf.ET, .REL),
2932 .dynamic => .DYN,
29332933 },
29342934 };
29352935 mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(elf_type), endian);
......@@ -3216,7 +3216,7 @@ fn allocateLinkerDefinedSymbols(self: *Elf) void {
32163216
32173217 // __rela_iplt_start, __rela_iplt_end
32183218 if (self.rela_dyn_section_index) |shndx| blk: {
3219 if (link_mode != .Static or comp.config.pie) break :blk;
3219 if (link_mode != .static or comp.config.pie) break :blk;
32203220 const shdr = &self.shdrs.items[shndx];
32213221 const end_addr = shdr.sh_addr + shdr.sh_size;
32223222 const start_addr = end_addr - self.calcNumIRelativeRelocs() * @sizeOf(elf.Elf64_Rela);
......@@ -5061,12 +5061,12 @@ const CsuObjects = struct {
50615061 } = switch (comp.config.output_mode) {
50625062 .Obj => return CsuObjects{},
50635063 .Lib => switch (comp.config.link_mode) {
5064 .Dynamic => .dynamic_lib,
5065 .Static => return CsuObjects{},
5064 .dynamic => .dynamic_lib,
5065 .static => return CsuObjects{},
50665066 },
50675067 .Exe => switch (comp.config.link_mode) {
5068 .Dynamic => if (comp.config.pie) .dynamic_pie else .dynamic_exe,
5069 .Static => if (comp.config.pie) .static_pie else .static_exe,
5068 .dynamic => if (comp.config.pie) .dynamic_pie else .dynamic_exe,
5069 .static => if (comp.config.pie) .static_pie else .static_exe,
50705070 },
50715071 };
50725072
src/link/MachO/load_commands.zig+1-1
......@@ -222,7 +222,7 @@ pub fn writeDylibLC(ctx: WriteDylibLCCtx, writer: anytype) !void {
222222pub fn writeDylibIdLC(macho_file: *MachO, writer: anytype) !void {
223223 const comp = macho_file.base.comp;
224224 const gpa = comp.gpa;
225 assert(comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic);
225 assert(comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic);
226226 const emit = macho_file.base.emit;
227227 const install_name = macho_file.install_name orelse
228228 try emit.directory.join(gpa, &.{emit.sub_path});
src/link/Wasm.zig+3-3
......@@ -2518,7 +2518,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node)
25182518 // When the target os is WASI, we allow linking with WASI-LIBC
25192519 if (target.os.tag == .wasi) {
25202520 const is_exe_or_dyn_lib = output_mode == .Exe or
2521 (output_mode == .Lib and link_mode == .Dynamic);
2521 (output_mode == .Lib and link_mode == .dynamic);
25222522 if (is_exe_or_dyn_lib) {
25232523 for (comp.wasi_emulated_libs) |crt_file| {
25242524 try positionals.append(try comp.get_libc_crt_file(
......@@ -3549,7 +3549,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo
35493549 try argv.append("--allow-undefined");
35503550 }
35513551
3552 if (comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic) {
3552 if (comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic) {
35533553 try argv.append("--shared");
35543554 }
35553555 if (comp.config.pie) {
......@@ -3569,7 +3569,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo
35693569
35703570 if (target.os.tag == .wasi) {
35713571 const is_exe_or_dyn_lib = comp.config.output_mode == .Exe or
3572 (comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic);
3572 (comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic);
35733573 if (is_exe_or_dyn_lib) {
35743574 for (comp.wasi_emulated_libs) |crt_file| {
35753575 try argv.append(try comp.get_libc_crt_file(
src/main.zig+32-32
......@@ -755,8 +755,8 @@ const SystemLib = struct {
755755 fn fallbackMode(this: SystemLib) std.builtin.LinkMode {
756756 assert(this.search_strategy != .no_fallback);
757757 return switch (this.preferred_mode) {
758 .Dynamic => .Static,
759 .Static => .Dynamic,
758 .dynamic => .static,
759 .static => .dynamic,
760760 };
761761 }
762762};
......@@ -892,7 +892,7 @@ fn buildOutputType(
892892 var entitlements: ?[]const u8 = null;
893893 var pagezero_size: ?u64 = null;
894894 var lib_search_strategy: SystemLib.SearchStrategy = .paths_first;
895 var lib_preferred_mode: std.builtin.LinkMode = .Dynamic;
895 var lib_preferred_mode: std.builtin.LinkMode = .dynamic;
896896 var headerpad_size: ?u32 = null;
897897 var headerpad_max_install_names: bool = false;
898898 var dead_strip_dylibs: bool = false;
......@@ -1166,22 +1166,22 @@ fn buildOutputType(
11661166 };
11671167 } else if (mem.eql(u8, arg, "-search_paths_first")) {
11681168 lib_search_strategy = .paths_first;
1169 lib_preferred_mode = .Dynamic;
1169 lib_preferred_mode = .dynamic;
11701170 } else if (mem.eql(u8, arg, "-search_paths_first_static")) {
11711171 lib_search_strategy = .paths_first;
1172 lib_preferred_mode = .Static;
1172 lib_preferred_mode = .static;
11731173 } else if (mem.eql(u8, arg, "-search_dylibs_first")) {
11741174 lib_search_strategy = .mode_first;
1175 lib_preferred_mode = .Dynamic;
1175 lib_preferred_mode = .dynamic;
11761176 } else if (mem.eql(u8, arg, "-search_static_first")) {
11771177 lib_search_strategy = .mode_first;
1178 lib_preferred_mode = .Static;
1178 lib_preferred_mode = .static;
11791179 } else if (mem.eql(u8, arg, "-search_dylibs_only")) {
11801180 lib_search_strategy = .no_fallback;
1181 lib_preferred_mode = .Dynamic;
1181 lib_preferred_mode = .dynamic;
11821182 } else if (mem.eql(u8, arg, "-search_static_only")) {
11831183 lib_search_strategy = .no_fallback;
1184 lib_preferred_mode = .Static;
1184 lib_preferred_mode = .static;
11851185 } else if (mem.eql(u8, arg, "-headerpad")) {
11861186 const next_arg = args_iter.nextOrFatal();
11871187 headerpad_size = std.fmt.parseUnsigned(u32, eatIntPrefix(next_arg, 16), 16) catch |err| {
......@@ -1478,12 +1478,12 @@ fn buildOutputType(
14781478 emit_implib = .no;
14791479 emit_implib_arg_provided = true;
14801480 } else if (mem.eql(u8, arg, "-dynamic")) {
1481 create_module.opts.link_mode = .Dynamic;
1482 lib_preferred_mode = .Dynamic;
1481 create_module.opts.link_mode = .dynamic;
1482 lib_preferred_mode = .dynamic;
14831483 lib_search_strategy = .mode_first;
14841484 } else if (mem.eql(u8, arg, "-static")) {
1485 create_module.opts.link_mode = .Static;
1486 lib_preferred_mode = .Static;
1485 create_module.opts.link_mode = .static;
1486 lib_preferred_mode = .static;
14871487 lib_search_strategy = .no_fallback;
14881488 } else if (mem.eql(u8, arg, "-fdll-export-fns")) {
14891489 create_module.opts.dll_export_fns = true;
......@@ -1904,7 +1904,7 @@ fn buildOutputType(
19041904 },
19051905 .nostdlib_cpp => create_module.opts.ensure_libcpp_on_non_freestanding = false,
19061906 .shared => {
1907 create_module.opts.link_mode = .Dynamic;
1907 create_module.opts.link_mode = .dynamic;
19081908 is_shared_lib = true;
19091909 },
19101910 .rdynamic => create_module.opts.rdynamic = true,
......@@ -1961,20 +1961,20 @@ fn buildOutputType(
19611961 mem.eql(u8, linker_arg, "-call_shared"))
19621962 {
19631963 lib_search_strategy = .no_fallback;
1964 lib_preferred_mode = .Dynamic;
1964 lib_preferred_mode = .dynamic;
19651965 } else if (mem.eql(u8, linker_arg, "-Bstatic") or
19661966 mem.eql(u8, linker_arg, "-dn") or
19671967 mem.eql(u8, linker_arg, "-non_shared") or
19681968 mem.eql(u8, linker_arg, "-static"))
19691969 {
19701970 lib_search_strategy = .no_fallback;
1971 lib_preferred_mode = .Static;
1971 lib_preferred_mode = .static;
19721972 } else if (mem.eql(u8, linker_arg, "-search_paths_first")) {
19731973 lib_search_strategy = .paths_first;
1974 lib_preferred_mode = .Dynamic;
1974 lib_preferred_mode = .dynamic;
19751975 } else if (mem.eql(u8, linker_arg, "-search_dylibs_first")) {
19761976 lib_search_strategy = .mode_first;
1977 lib_preferred_mode = .Dynamic;
1977 lib_preferred_mode = .dynamic;
19781978 } else {
19791979 try linker_args.append(linker_arg);
19801980 }
......@@ -3033,7 +3033,7 @@ fn buildOutputType(
30333033
30343034 const is_exe_or_dyn_lib = switch (create_module.resolved_options.output_mode) {
30353035 .Obj => false,
3036 .Lib => create_module.resolved_options.link_mode == .Dynamic,
3036 .Lib => create_module.resolved_options.link_mode == .dynamic,
30373037 .Exe => true,
30383038 };
30393039 // Note that cmake when targeting Windows will try to execute
......@@ -3770,8 +3770,8 @@ fn createModule(
37703770 )) {
37713771 const path = try arena.dupe(u8, test_path.items);
37723772 switch (info.preferred_mode) {
3773 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3774 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3773 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3774 .dynamic => try create_module.resolved_system_libs.append(arena, .{
37753775 .name = lib_name,
37763776 .lib = .{
37773777 .needed = info.needed,
......@@ -3804,8 +3804,8 @@ fn createModule(
38043804 )) {
38053805 const path = try arena.dupe(u8, test_path.items);
38063806 switch (info.fallbackMode()) {
3807 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3808 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3807 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3808 .dynamic => try create_module.resolved_system_libs.append(arena, .{
38093809 .name = lib_name,
38103810 .lib = .{
38113811 .needed = info.needed,
......@@ -3838,8 +3838,8 @@ fn createModule(
38383838 )) {
38393839 const path = try arena.dupe(u8, test_path.items);
38403840 switch (info.preferred_mode) {
3841 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3842 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3841 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3842 .dynamic => try create_module.resolved_system_libs.append(arena, .{
38433843 .name = lib_name,
38443844 .lib = .{
38453845 .needed = info.needed,
......@@ -3862,8 +3862,8 @@ fn createModule(
38623862 )) {
38633863 const path = try arena.dupe(u8, test_path.items);
38643864 switch (info.fallbackMode()) {
3865 .Static => try create_module.link_objects.append(arena, .{ .path = path }),
3866 .Dynamic => try create_module.resolved_system_libs.append(arena, .{
3865 .static => try create_module.link_objects.append(arena, .{ .path = path }),
3866 .dynamic => try create_module.resolved_system_libs.append(arena, .{
38673867 .name = lib_name,
38683868 .lib = .{
38693869 .needed = info.needed,
......@@ -6842,7 +6842,7 @@ fn accessLibPath(
68426842) !bool {
68436843 const sep = fs.path.sep_str;
68446844
6845 if (target.isDarwin() and link_mode == .Dynamic) tbd: {
6845 if (target.isDarwin() and link_mode == .dynamic) tbd: {
68466846 // Prefer .tbd over .dylib.
68476847 test_path.clearRetainingCapacity();
68486848 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.tbd", .{ lib_dir_path, lib_name });
......@@ -6863,8 +6863,8 @@ fn accessLibPath(
68636863 target.libPrefix(),
68646864 lib_name,
68656865 switch (link_mode) {
6866 .Static => target.staticLibSuffix(),
6867 .Dynamic => target.dynamicLibSuffix(),
6866 .static => target.staticLibSuffix(),
6867 .dynamic => target.dynamicLibSuffix(),
68686868 },
68696869 });
68706870 try checked_paths.writer().print("\n {s}", .{test_path.items});
......@@ -6879,7 +6879,7 @@ fn accessLibPath(
68796879
68806880 // In the case of Darwin, the main check will be .dylib, so here we
68816881 // additionally check for .so files.
6882 if (target.isDarwin() and link_mode == .Dynamic) so: {
6882 if (target.isDarwin() and link_mode == .dynamic) so: {
68836883 test_path.clearRetainingCapacity();
68846884 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ lib_dir_path, lib_name });
68856885 try checked_paths.writer().print("\n {s}", .{test_path.items});
......@@ -6894,7 +6894,7 @@ fn accessLibPath(
68946894
68956895 // In the case of MinGW, the main check will be .lib but we also need to
68966896 // look for `libfoo.a`.
6897 if (target.isMinGW() and link_mode == .Static) mingw: {
6897 if (target.isMinGW() and link_mode == .static) mingw: {
68986898 test_path.clearRetainingCapacity();
68996899 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.a", .{
69006900 lib_dir_path, lib_name,
src/musl.zig+1-1
......@@ -207,7 +207,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
207207 const strip = comp.compilerRtStrip();
208208 const config = try Compilation.Config.resolve(.{
209209 .output_mode = .Lib,
210 .link_mode = .Dynamic,
210 .link_mode = .dynamic,
211211 .resolved_target = comp.root_mod.resolved_target,
212212 .is_test = false,
213213 .have_zcu = false,
test/behavior/export_builtin.zig+2-2
......@@ -25,7 +25,7 @@ test "exporting with internal linkage" {
2525 const S = struct {
2626 fn foo() callconv(.C) void {}
2727 comptime {
28 @export(foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .Internal });
28 @export(foo, .{ .name = "exporting_with_internal_linkage_foo", .linkage = .internal });
2929 }
3030 };
3131 S.foo();
......@@ -41,7 +41,7 @@ test "exporting using field access" {
4141 const x: u32 = 5;
4242 };
4343 comptime {
44 @export(Inner.x, .{ .name = "foo", .linkage = .Internal });
44 @export(Inner.x, .{ .name = "foo", .linkage = .internal });
4545 }
4646 };
4747
test/standalone/global_linkage/obj1.zig+2-2
......@@ -2,6 +2,6 @@ var internal_integer: usize = 1;
22var obj1_integer: usize = 421;
33
44comptime {
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .Internal });
6 @export(obj1_integer, .{ .name = "obj1_integer", .linkage = .Strong });
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .internal });
6 @export(obj1_integer, .{ .name = "obj1_integer", .linkage = .strong });
77}
test/standalone/global_linkage/obj2.zig+2-2
......@@ -2,6 +2,6 @@ var internal_integer: usize = 2;
22var obj2_integer: usize = 422;
33
44comptime {
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .Internal });
6 @export(obj2_integer, .{ .name = "obj2_integer", .linkage = .Strong });
5 @export(internal_integer, .{ .name = "internal_integer", .linkage = .internal });
6 @export(obj2_integer, .{ .name = "obj2_integer", .linkage = .strong });
77}
tools/docgen.zig+3-3
......@@ -629,7 +629,7 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc {
629629 } else if (mem.eql(u8, end_tag_name, "link_libc")) {
630630 link_libc = true;
631631 } else if (mem.eql(u8, end_tag_name, "link_mode_dynamic")) {
632 link_mode = .Dynamic;
632 link_mode = .dynamic;
633633 } else if (mem.eql(u8, end_tag_name, "additonal_option")) {
634634 _ = try eatToken(tokenizer, .separator);
635635 const option = try eatToken(tokenizer, .tag_content);
......@@ -1793,11 +1793,11 @@ fn genHtml(
17931793 }
17941794 if (code.link_mode) |link_mode| {
17951795 switch (link_mode) {
1796 .Static => {
1796 .static => {
17971797 try test_args.append("-static");
17981798 try shell_out.print("-static ", .{});
17991799 },
1800 .Dynamic => {
1800 .dynamic => {
18011801 try test_args.append("-dynamic");
18021802 try shell_out.print("-dynamic ", .{});
18031803 },