aboutsummaryrefslogtreecommitdiff
path: root/std/build.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-04-28 10:46:01 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-04-28 10:46:01 -0400
commitd04d3ec7753af834ea7be9905377fc60baea8ccc (patch)
tree350a8836a366a63baf44d793c987cd0c3c2d19ab /std/build.zig
parenta147f065850af8f9422d19d14aec0476b641cb07 (diff)
downloadzig-d04d3ec7753af834ea7be9905377fc60baea8ccc.tar.gz
zig-d04d3ec7753af834ea7be9905377fc60baea8ccc.zip
build system: remove setLinkerScriptContents
Diffstat (limited to 'std/build.zig')
-rw-r--r--std/build.zig34
1 files changed, 6 insertions, 28 deletions
diff --git a/std/build.zig b/std/build.zig
index fa22d53044..89079f722f 100644
--- a/std/build.zig
+++ b/std/build.zig
@@ -609,19 +609,13 @@ const Target = enum {
}
};
-const LinkerScript = enum {
- None,
- Embed: []const u8,
- Path: []const u8,
-};
-
pub const LibExeObjStep = struct {
step: Step,
builder: &Builder,
root_src: ?[]const u8,
name: []const u8,
target: Target,
- linker_script: LinkerScript,
+ linker_script: ?[]const u8,
link_libs: BufSet,
verbose: bool,
release: bool,
@@ -679,7 +673,7 @@ pub const LibExeObjStep = struct {
.root_src = root_src,
.name = name,
.target = Target.Native,
- .linker_script = LinkerScript.None,
+ .linker_script = null,
.link_libs = BufSet.init(builder.allocator),
.step = Step.init(name, builder.allocator, make),
.output_path = null,
@@ -726,14 +720,8 @@ pub const LibExeObjStep = struct {
self.computeOutFileNames();
}
- /// LibExeObjStep keeps a reference to script for its lifetime or until this function
- /// is called again.
- pub fn setLinkerScriptContents(self: &LibExeObjStep, script: []const u8) {
- self.linker_script = LinkerScript.Embed { script };
- }
-
pub fn setLinkerScriptPath(self: &LibExeObjStep, path: []const u8) {
- self.linker_script = LinkerScript.Path { path };
+ self.linker_script = path;
}
pub fn linkSystemLibrary(self: &LibExeObjStep, name: []const u8) {
@@ -852,19 +840,9 @@ pub const LibExeObjStep = struct {
},
}
- switch (self.linker_script) {
- LinkerScript.None => {},
- LinkerScript.Embed => |script| {
- const tmp_file_name = "linker.ld.tmp"; // TODO issue #298
- io.writeFile(tmp_file_name, script, builder.allocator)
- %% |err| debug.panic("unable to write linker script: {}\n", @errorName(err));
- %%zig_args.append("--linker-script");
- %%zig_args.append(tmp_file_name);
- },
- LinkerScript.Path => |path| {
- %%zig_args.append("--linker-script");
- %%zig_args.append(path);
- },
+ test (self.linker_script) |linker_script| {
+ %%zig_args.append("--linker-script");
+ %%zig_args.append(linker_script);
}
{