aboutsummaryrefslogtreecommitdiff
path: root/src/link/Elf.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-08-19 21:49:29 -0700
committerGitHub <noreply@github.com>2024-08-19 21:49:29 -0700
commitdffc8c44f9a01aa05ea364ffdc71509d15bc2601 (patch)
treeb9b610ac10bb537b8b0dfba500f6599c5e4b2e15 /src/link/Elf.zig
parent7071d1b3c2ed908bb8f1170673b50568ed56da7b (diff)
parent80999391d9b0db0303f59942cb52542a6e4da331 (diff)
downloadzig-dffc8c44f9a01aa05ea364ffdc71509d15bc2601.tar.gz
zig-dffc8c44f9a01aa05ea364ffdc71509d15bc2601.zip
Merge pull request #21115 from Snektron/build-system-asm
compilation and build system fixes
Diffstat (limited to 'src/link/Elf.zig')
-rw-r--r--src/link/Elf.zig13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index 5a35e67b02..4afc592002 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -204,7 +204,7 @@ pub const SortSection = enum { name, alignment };
pub fn createEmpty(
arena: Allocator,
comp: *Compilation,
- emit: Compilation.Emit,
+ emit: Path,
options: link.File.OpenOptions,
) !*Elf {
const target = comp.root_mod.resolved_target.result;
@@ -321,7 +321,7 @@ pub fn createEmpty(
// If using LLD to link, this code should produce an object file so that it
// can be passed to LLD.
const sub_path = if (use_lld) zcu_object_sub_path.? else emit.sub_path;
- self.base.file = try emit.directory.handle.createFile(sub_path, .{
+ self.base.file = try emit.root_dir.handle.createFile(sub_path, .{
.truncate = true,
.read = true,
.mode = link.File.determineMode(use_lld, output_mode, link_mode),
@@ -401,7 +401,7 @@ pub fn createEmpty(
pub fn open(
arena: Allocator,
comp: *Compilation,
- emit: Compilation.Emit,
+ emit: Path,
options: link.File.OpenOptions,
) !*Elf {
// TODO: restore saved linker state, don't truncate the file, and
@@ -999,7 +999,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
const target = comp.root_mod.resolved_target.result;
const link_mode = comp.config.link_mode;
- const directory = self.base.emit.directory; // Just an alias to make it shorter to type.
+ const directory = self.base.emit.root_dir; // Just an alias to make it shorter to type.
const full_out_path = try directory.join(arena, &[_][]const u8{self.base.emit.sub_path});
const module_obj_path: ?[]const u8 = if (self.base.zcu_object_sub_path) |path| blk: {
if (fs.path.dirname(full_out_path)) |dirname| {
@@ -1356,7 +1356,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
const target = self.base.comp.root_mod.resolved_target.result;
const link_mode = self.base.comp.config.link_mode;
- const directory = self.base.emit.directory; // Just an alias to make it shorter to type.
+ const directory = self.base.emit.root_dir; // Just an alias to make it shorter to type.
const full_out_path = try directory.join(arena, &[_][]const u8{self.base.emit.sub_path});
const module_obj_path: ?[]const u8 = if (self.base.zcu_object_sub_path) |path| blk: {
if (fs.path.dirname(full_out_path)) |dirname| {
@@ -2054,7 +2054,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s
const comp = self.base.comp;
const gpa = comp.gpa;
- const directory = self.base.emit.directory; // Just an alias to make it shorter to type.
+ const directory = self.base.emit.root_dir; // Just an alias to make it shorter to type.
const full_out_path = try directory.join(arena, &[_][]const u8{self.base.emit.sub_path});
// If there is no Zig code to compile, then we should skip flushing the output file because it
@@ -6016,6 +6016,7 @@ const Allocator = std.mem.Allocator;
const Archive = @import("Elf/Archive.zig");
pub const Atom = @import("Elf/Atom.zig");
const Cache = std.Build.Cache;
+const Path = Cache.Path;
const Compilation = @import("../Compilation.zig");
const ComdatGroupSection = synthetic_sections.ComdatGroupSection;
const CopyRelSection = synthetic_sections.CopyRelSection;