aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorTristan Ross <tristan.ross@midstall.com>2024-02-18 20:34:32 -0800
committerTristan Ross <tristan.ross@midstall.com>2024-03-11 07:09:10 -0700
commit9d70d614ae33133f3786ec056b8660476ff49f53 (patch)
tree61c46c488ae72d9ea9e96f25b661dc8d374abe5f /src/link
parent099f3c4039d5702b073639ef8b55881973b71c80 (diff)
downloadzig-9d70d614ae33133f3786ec056b8660476ff49f53.tar.gz
zig-9d70d614ae33133f3786ec056b8660476ff49f53.zip
std.builtin: make link mode fields lowercase
Diffstat (limited to 'src/link')
-rw-r--r--src/link/Coff.zig2
-rw-r--r--src/link/Coff/lld.zig10
-rw-r--r--src/link/Elf.zig52
-rw-r--r--src/link/MachO/load_commands.zig2
-rw-r--r--src/link/Wasm.zig6
5 files changed, 36 insertions, 36 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig
index 5bf83b52ea..adea78ca73 100644
--- a/src/link/Coff.zig
+++ b/src/link/Coff.zig
@@ -2275,7 +2275,7 @@ fn writeHeader(self: *Coff) !void {
.p32 => flags.@"32BIT_MACHINE" = 1,
.p64 => flags.LARGE_ADDRESS_AWARE = 1,
}
- if (self.base.comp.config.output_mode == .Lib and self.base.comp.config.link_mode == .Dynamic) {
+ if (self.base.comp.config.output_mode == .Lib and self.base.comp.config.link_mode == .dynamic) {
flags.DLL = 1;
}
diff --git a/src/link/Coff/lld.zig b/src/link/Coff/lld.zig
index 475090c31d..405c107628 100644
--- a/src/link/Coff/lld.zig
+++ b/src/link/Coff/lld.zig
@@ -45,7 +45,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node)
defer sub_prog_node.end();
const is_lib = comp.config.output_mode == .Lib;
- const is_dyn_lib = comp.config.link_mode == .Dynamic and is_lib;
+ const is_dyn_lib = comp.config.link_mode == .dynamic and is_lib;
const is_exe_or_dyn_lib = is_dyn_lib or comp.config.output_mode == .Exe;
const link_in_crt = comp.config.link_libc and is_exe_or_dyn_lib;
const target = comp.root_mod.resolved_target.result;
@@ -411,16 +411,16 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node)
try argv.append(try comp.get_libc_crt_file(arena, "mingwex.lib"));
} else {
const lib_str = switch (comp.config.link_mode) {
- .Dynamic => "",
- .Static => "lib",
+ .dynamic => "",
+ .static => "lib",
};
const d_str = switch (optimize_mode) {
.Debug => "d",
else => "",
};
switch (comp.config.link_mode) {
- .Static => try argv.append(try allocPrint(arena, "libcmt{s}.lib", .{d_str})),
- .Dynamic => try argv.append(try allocPrint(arena, "msvcrt{s}.lib", .{d_str})),
+ .static => try argv.append(try allocPrint(arena, "libcmt{s}.lib", .{d_str})),
+ .dynamic => try argv.append(try allocPrint(arena, "msvcrt{s}.lib", .{d_str})),
}
try argv.append(try allocPrint(arena, "{s}vcruntime{s}.lib", .{ lib_str, d_str }));
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index 85ef62b4bc..d26f49ca09 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -262,7 +262,7 @@ pub fn createEmpty(
.sparc64 => 0x2000,
else => 0x1000,
};
- const is_dyn_lib = output_mode == .Lib and link_mode == .Dynamic;
+ const is_dyn_lib = output_mode == .Lib and link_mode == .dynamic;
const default_sym_version: elf.Elf64_Versym = if (is_dyn_lib or comp.config.rdynamic)
elf.VER_NDX_GLOBAL
else
@@ -349,7 +349,7 @@ pub fn createEmpty(
}
const is_obj = output_mode == .Obj;
- const is_obj_or_ar = is_obj or (output_mode == .Lib and link_mode == .Static);
+ const is_obj_or_ar = is_obj or (output_mode == .Lib and link_mode == .static);
// What path should this ELF linker code output to?
// 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)
success: {
if (!self.base.isStatic()) {
- if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .Dynamic))
+ if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .dynamic))
break :success;
}
- if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .Static))
+ if (try self.accessLibPath(arena, &test_path, &checked_paths, lc.crt_dir.?, lib_name, .static))
break :success;
try self.reportMissingLibraryError(
@@ -1211,8 +1211,8 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node)
});
} else if (target.isMusl()) {
const path = try comp.get_libc_crt_file(arena, switch (link_mode) {
- .Static => "libc.a",
- .Dynamic => "libc.so",
+ .static => "libc.a",
+ .dynamic => "libc.so",
});
try system_libs.append(.{ .path = path });
} else {
@@ -1628,7 +1628,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
// libc dep
if (comp.config.link_libc) {
if (self.base.comp.libc_installation != null) {
- const needs_grouping = link_mode == .Static;
+ const needs_grouping = link_mode == .static;
if (needs_grouping) try argv.append("--start-group");
try argv.appendSlice(target_util.libcFullLinkFlags(target));
if (needs_grouping) try argv.append("--end-group");
@@ -1642,8 +1642,8 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a"));
} else if (target.isMusl()) {
try argv.append(try comp.get_libc_crt_file(arena, switch (link_mode) {
- .Static => "libc.a",
- .Dynamic => "libc.so",
+ .static => "libc.a",
+ .dynamic => "libc.so",
}));
}
}
@@ -1797,10 +1797,10 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {
// Maybe we should hoist search-strategy all the way here?
for (self.lib_dirs) |lib_dir| {
if (!self.base.isStatic()) {
- if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .Dynamic))
+ if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .dynamic))
break :success;
}
- if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .Static))
+ if (try self.accessLibPath(arena, &test_path, &checked_paths, lib_dir, lib_name, .static))
break :success;
}
} else {
@@ -1858,8 +1858,8 @@ fn accessLibPath(
test_path.clearRetainingCapacity();
const prefix = if (link_mode != null) "lib" else "";
const suffix = if (link_mode) |mode| switch (mode) {
- .Static => target.staticLibSuffix(),
- .Dynamic => target.dynamicLibSuffix(),
+ .static => target.staticLibSuffix(),
+ .dynamic => target.dynamicLibSuffix(),
} else "";
try test_path.writer().print("{s}" ++ sep ++ "{s}{s}{s}", .{
lib_dir_path,
@@ -2150,10 +2150,10 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
const is_obj = output_mode == .Obj;
const is_lib = output_mode == .Lib;
const link_mode = comp.config.link_mode;
- const is_dyn_lib = link_mode == .Dynamic and is_lib;
+ const is_dyn_lib = link_mode == .dynamic and is_lib;
const is_exe_or_dyn_lib = is_dyn_lib or output_mode == .Exe;
const have_dynamic_linker = comp.config.link_libc and
- link_mode == .Dynamic and is_exe_or_dyn_lib;
+ link_mode == .dynamic and is_exe_or_dyn_lib;
const target = comp.root_mod.resolved_target.result;
const compiler_rt_path: ?[]const u8 = blk: {
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
try argv.append(arg);
}
- if (link_mode == .Static) {
+ if (link_mode == .static) {
if (target.cpu.arch.isArmOrThumb()) {
try argv.append("-Bstatic");
} else {
@@ -2647,7 +2647,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
comp.link_error_flags.missing_libc = false;
if (comp.config.link_libc) {
if (comp.libc_installation != null) {
- const needs_grouping = link_mode == .Static;
+ const needs_grouping = link_mode == .static;
if (needs_grouping) try argv.append("--start-group");
try argv.appendSlice(target_util.libcFullLinkFlags(target));
if (needs_grouping) try argv.append("--end-group");
@@ -2661,8 +2661,8 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: *std.Progress.Node) !voi
try argv.append(try comp.get_libc_crt_file(arena, "libc_nonshared.a"));
} else if (target.isMusl()) {
try argv.append(try comp.get_libc_crt_file(arena, switch (link_mode) {
- .Static => "libc.a",
- .Dynamic => "libc.so",
+ .static => "libc.a",
+ .dynamic => "libc.so",
}));
} else {
comp.link_error_flags.missing_libc = true;
@@ -2928,8 +2928,8 @@ pub fn writeElfHeader(self: *Elf) !void {
.Exe => if (comp.config.pie) .DYN else .EXEC,
.Obj => .REL,
.Lib => switch (link_mode) {
- .Static => @as(elf.ET, .REL),
- .Dynamic => .DYN,
+ .static => @as(elf.ET, .REL),
+ .dynamic => .DYN,
},
};
mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(elf_type), endian);
@@ -3216,7 +3216,7 @@ fn allocateLinkerDefinedSymbols(self: *Elf) void {
// __rela_iplt_start, __rela_iplt_end
if (self.rela_dyn_section_index) |shndx| blk: {
- if (link_mode != .Static or comp.config.pie) break :blk;
+ if (link_mode != .static or comp.config.pie) break :blk;
const shdr = &self.shdrs.items[shndx];
const end_addr = shdr.sh_addr + shdr.sh_size;
const start_addr = end_addr - self.calcNumIRelativeRelocs() * @sizeOf(elf.Elf64_Rela);
@@ -5061,12 +5061,12 @@ const CsuObjects = struct {
} = switch (comp.config.output_mode) {
.Obj => return CsuObjects{},
.Lib => switch (comp.config.link_mode) {
- .Dynamic => .dynamic_lib,
- .Static => return CsuObjects{},
+ .dynamic => .dynamic_lib,
+ .static => return CsuObjects{},
},
.Exe => switch (comp.config.link_mode) {
- .Dynamic => if (comp.config.pie) .dynamic_pie else .dynamic_exe,
- .Static => if (comp.config.pie) .static_pie else .static_exe,
+ .dynamic => if (comp.config.pie) .dynamic_pie else .dynamic_exe,
+ .static => if (comp.config.pie) .static_pie else .static_exe,
},
};
diff --git a/src/link/MachO/load_commands.zig b/src/link/MachO/load_commands.zig
index 778fdd74c7..394253db48 100644
--- a/src/link/MachO/load_commands.zig
+++ b/src/link/MachO/load_commands.zig
@@ -222,7 +222,7 @@ pub fn writeDylibLC(ctx: WriteDylibLCCtx, writer: anytype) !void {
pub fn writeDylibIdLC(macho_file: *MachO, writer: anytype) !void {
const comp = macho_file.base.comp;
const gpa = comp.gpa;
- assert(comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic);
+ assert(comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic);
const emit = macho_file.base.emit;
const install_name = macho_file.install_name orelse
try emit.directory.join(gpa, &.{emit.sub_path});
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index c32a472213..128cec5b6e 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -2518,7 +2518,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node)
// When the target os is WASI, we allow linking with WASI-LIBC
if (target.os.tag == .wasi) {
const is_exe_or_dyn_lib = output_mode == .Exe or
- (output_mode == .Lib and link_mode == .Dynamic);
+ (output_mode == .Lib and link_mode == .dynamic);
if (is_exe_or_dyn_lib) {
for (comp.wasi_emulated_libs) |crt_file| {
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
try argv.append("--allow-undefined");
}
- if (comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic) {
+ if (comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic) {
try argv.append("--shared");
}
if (comp.config.pie) {
@@ -3569,7 +3569,7 @@ fn linkWithLLD(wasm: *Wasm, arena: Allocator, prog_node: *std.Progress.Node) !vo
if (target.os.tag == .wasi) {
const is_exe_or_dyn_lib = comp.config.output_mode == .Exe or
- (comp.config.output_mode == .Lib and comp.config.link_mode == .Dynamic);
+ (comp.config.output_mode == .Lib and comp.config.link_mode == .dynamic);
if (is_exe_or_dyn_lib) {
for (comp.wasi_emulated_libs) |crt_file| {
try argv.append(try comp.get_libc_crt_file(