authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-28 10:46:01-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-28 10:46:01-04:00
logd04d3ec7753af834ea7be9905377fc60baea8ccc
tree350a8836a366a63baf44d793c987cd0c3c2d19ab
parenta147f065850af8f9422d19d14aec0476b641cb07

build system: remove setLinkerScriptContents


1 files changed, 6 insertions(+), 28 deletions(-)

std/build.zig+6-28
......@@ -609,19 +609,13 @@ const Target = enum {
609609 }
610610};
611611
612const LinkerScript = enum {
613 None,
614 Embed: []const u8,
615 Path: []const u8,
616};
617
618612pub 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 {