aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
Diffstat (limited to 'src/link')
-rw-r--r--src/link/MachO.zig3
-rw-r--r--src/link/MachO/DebugSymbols.zig7
-rw-r--r--src/link/MachO/Object.zig1
-rw-r--r--src/link/MachO/Zld.zig6
-rw-r--r--src/link/MachO/reloc/x86_64.zig1
-rw-r--r--src/link/Wasm.zig1
6 files changed, 1 insertions, 18 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index 8c1d092f12..e82589f144 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -2918,7 +2918,6 @@ fn relocateSymbolTable(self: *MachO) !void {
const nsyms = nlocals + nglobals + nundefs;
if (symtab.nsyms < nsyms) {
- const linkedit_segment = self.load_commands.items[self.linkedit_segment_cmd_index.?].Segment;
const needed_size = nsyms * @sizeOf(macho.nlist_64);
if (needed_size > self.allocatedSizeLinkedit(symtab.symoff)) {
// Move the entire symbol table to a new location
@@ -3150,7 +3149,6 @@ fn writeExportTrie(self: *MachO) !void {
const nwritten = try trie.write(stream.writer());
assert(nwritten == trie.size);
- const linkedit_segment = self.load_commands.items[self.linkedit_segment_cmd_index.?].Segment;
const dyld_info = &self.load_commands.items[self.dyld_info_cmd_index.?].DyldInfoOnly;
const allocated_size = self.allocatedSizeLinkedit(dyld_info.export_off);
const needed_size = mem.alignForwardGeneric(u64, buffer.len, @alignOf(u64));
@@ -3357,7 +3355,6 @@ fn populateLazyBindOffsetsInStubHelper(self: *MachO, buffer: []const u8) !void {
error.EndOfStream => break,
else => return err,
};
- const imm: u8 = inst & macho.BIND_IMMEDIATE_MASK;
const opcode: u8 = inst & macho.BIND_OPCODE_MASK;
switch (opcode) {
diff --git a/src/link/MachO/DebugSymbols.zig b/src/link/MachO/DebugSymbols.zig
index ca6e5157b3..218911f7ab 100644
--- a/src/link/MachO/DebugSymbols.zig
+++ b/src/link/MachO/DebugSymbols.zig
@@ -500,7 +500,6 @@ pub fn flushModule(self: *DebugSymbols, allocator: *Allocator, options: link.Opt
if (self.debug_aranges_section_dirty) {
const dwarf_segment = &self.load_commands.items[self.dwarf_segment_cmd_index.?].Segment;
const debug_aranges_sect = &dwarf_segment.sections.items[self.debug_aranges_section_index.?];
- const debug_info_sect = dwarf_segment.sections.items[self.debug_info_section_index.?];
var di_buf = std.ArrayList(u8).init(allocator);
defer di_buf.deinit();
@@ -844,7 +843,6 @@ fn relocateSymbolTable(self: *DebugSymbols) !void {
const nsyms = nlocals + nglobals;
if (symtab.nsyms < nsyms) {
- const linkedit_segment = self.load_commands.items[self.linkedit_segment_cmd_index.?].Segment;
const needed_size = nsyms * @sizeOf(macho.nlist_64);
if (needed_size > self.allocatedSizeLinkedit(symtab.symoff)) {
// Move the entire symbol table to a new location
@@ -904,11 +902,6 @@ pub fn updateDeclLineNumber(self: *DebugSymbols, module: *Module, decl: *const M
const tracy = trace(@src());
defer tracy.end();
- const tree = decl.namespace.file_scope.tree;
- const node_tags = tree.nodes.items(.tag);
- const node_datas = tree.nodes.items(.data);
- const token_starts = tree.tokens.items(.start);
-
const func = decl.val.castTag(.function).?.data;
const line_off = @intCast(u28, decl.src_line + func.lbrace_line);
diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig
index c4a044b446..f9c33bfa5c 100644
--- a/src/link/MachO/Object.zig
+++ b/src/link/MachO/Object.zig
@@ -478,7 +478,6 @@ pub fn parseDebugInfo(self: *Object) !void {
self.tu_path = try std.fs.path.join(self.allocator, &[_][]const u8{ comp_dir, name });
self.tu_mtime = mtime: {
- var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const stat = try self.file.?.stat();
break :mtime @intCast(u64, @divFloor(stat.mtime, 1_000_000_000));
};
diff --git a/src/link/MachO/Zld.zig b/src/link/MachO/Zld.zig
index 2c8b77d983..4b19891c77 100644
--- a/src/link/MachO/Zld.zig
+++ b/src/link/MachO/Zld.zig
@@ -432,7 +432,6 @@ fn mapAndUpdateSections(
fn updateMetadata(self: *Zld) !void {
for (self.objects.items) |object| {
- const object_seg = object.load_commands.items[object.segment_cmd_index.?].Segment;
const text_seg = &self.load_commands.items[self.text_segment_cmd_index.?].Segment;
const data_const_seg = &self.load_commands.items[self.data_const_segment_cmd_index.?].Segment;
const data_seg = &self.load_commands.items[self.data_segment_cmd_index.?].Segment;
@@ -1294,7 +1293,6 @@ fn allocateLinkeditSegment(self: *Zld) void {
}
fn allocateSegment(self: *Zld, index: u16, offset: u64) !void {
- const base_vmaddr = self.load_commands.items[self.pagezero_segment_cmd_index.?].Segment.inner.vmsize;
const seg = &self.load_commands.items[index].Segment;
// Allocate the sections according to their alignment at the beginning of the segment.
@@ -1427,7 +1425,6 @@ fn writeStubHelperCommon(self: *Zld) !void {
const got = &data_const_segment.sections.items[self.got_section_index.?];
const data_segment = &self.load_commands.items[self.data_segment_cmd_index.?].Segment;
const data = &data_segment.sections.items[self.data_section_index.?];
- const la_symbol_ptr = data_segment.sections.items[self.la_symbol_ptr_section_index.?];
self.stub_helper_stubs_start_off = blk: {
switch (self.arch.?) {
@@ -2654,7 +2651,6 @@ fn setEntryPoint(self: *Zld) !void {
// TODO we should respect the -entry flag passed in by the user to set a custom
// entrypoint. For now, assume default of `_main`.
const seg = self.load_commands.items[self.text_segment_cmd_index.?].Segment;
- const text = seg.sections.items[self.text_section_index.?];
const sym = self.globals.get("_main") orelse return error.MissingMainEntrypoint;
const entry_sym = sym.cast(Symbol.Regular) orelse unreachable;
const ec = &self.load_commands.items[self.main_cmd_index.?].Main;
@@ -2862,7 +2858,6 @@ fn populateLazyBindOffsetsInStubHelper(self: *Zld, buffer: []const u8) !void {
error.EndOfStream => break,
else => return err,
};
- const imm: u8 = inst & macho.BIND_IMMEDIATE_MASK;
const opcode: u8 = inst & macho.BIND_OPCODE_MASK;
switch (opcode) {
@@ -2959,6 +2954,7 @@ fn writeDebugInfo(self: *Zld) !void {
for (self.objects.items) |object| {
const tu_path = object.tu_path orelse continue;
const tu_mtime = object.tu_mtime orelse continue;
+ _ = tu_mtime;
const dirname = std.fs.path.dirname(tu_path) orelse "./";
// Current dir
try stabs.append(.{
diff --git a/src/link/MachO/reloc/x86_64.zig b/src/link/MachO/reloc/x86_64.zig
index 2a457fdea2..6df68b6b3e 100644
--- a/src/link/MachO/reloc/x86_64.zig
+++ b/src/link/MachO/reloc/x86_64.zig
@@ -175,7 +175,6 @@ pub const Parser = struct {
const rel_type = @intToEnum(macho.reloc_type_x86_64, rel.r_type);
const target = Relocation.Target.from_reloc(rel, parser.symbols);
- const is_extern = rel.r_extern == 1;
const offset = @intCast(u32, rel.r_address);
const inst = parser.code[offset..][0..4];
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index 3fcdc04e71..35da20291d 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -496,7 +496,6 @@ pub fn flushModule(self: *Wasm, comp: *Compilation) !void {
if (data_size != 0) {
const header_offset = try reserveVecSectionHeader(file);
const writer = file.writer();
- var len: u32 = 0;
// index to memory section (currently, there can only be 1 memory section in wasm)
try leb.writeULEB128(writer, @as(u32, 0));