Skip to content

Commit d04d3ec

Browse files
committed
build system: remove setLinkerScriptContents
1 parent a147f06 commit d04d3ec

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

std/build.zig

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -609,19 +609,13 @@ const Target = enum {
609609
}
610610
};
611611

612-
const LinkerScript = enum {
613-
None,
614-
Embed: []const u8,
615-
Path: []const u8,
616-
};
617-
618612
pub const LibExeObjStep = struct {
619613
step: Step,
620614
builder: &Builder,
621615
root_src: ?[]const u8,
622616
name: []const u8,
623617
target: Target,
624-
linker_script: LinkerScript,
618+
linker_script: ?[]const u8,
625619
link_libs: BufSet,
626620
verbose: bool,
627621
release: bool,
@@ -679,7 +673,7 @@ pub const LibExeObjStep = struct {
679673
.root_src = root_src,
680674
.name = name,
681675
.target = Target.Native,
682-
.linker_script = LinkerScript.None,
676+
.linker_script = null,
683677
.link_libs = BufSet.init(builder.allocator),
684678
.step = Step.init(name, builder.allocator, make),
685679
.output_path = null,
@@ -726,14 +720,8 @@ pub const LibExeObjStep = struct {
726720
self.computeOutFileNames();
727721
}
728722

729-
/// LibExeObjStep keeps a reference to script for its lifetime or until this function
730-
/// is called again.
731-
pub fn setLinkerScriptContents(self: &LibExeObjStep, script: []const u8) {
732-
self.linker_script = LinkerScript.Embed { script };
733-
}
734-
735723
pub fn setLinkerScriptPath(self: &LibExeObjStep, path: []const u8) {
736-
self.linker_script = LinkerScript.Path { path };
724+
self.linker_script = path;
737725
}
738726

739727
pub fn linkSystemLibrary(self: &LibExeObjStep, name: []const u8) {
@@ -852,19 +840,9 @@ pub const LibExeObjStep = struct {
852840
},
853841
}
854842

855-
switch (self.linker_script) {
856-
LinkerScript.None => {},
857-
LinkerScript.Embed => |script| {
858-
const tmp_file_name = "linker.ld.tmp"; // TODO issue #298
859-
io.writeFile(tmp_file_name, script, builder.allocator)
860-
%% |err| debug.panic("unable to write linker script: {}\n", @errorName(err));
861-
%%zig_args.append("--linker-script");
862-
%%zig_args.append(tmp_file_name);
863-
},
864-
LinkerScript.Path => |path| {
865-
%%zig_args.append("--linker-script");
866-
%%zig_args.append(path);
867-
},
843+
test (self.linker_script) |linker_script| {
844+
%%zig_args.append("--linker-script");
845+
%%zig_args.append(linker_script);
868846
}
869847

870848
{

0 commit comments

Comments
 (0)