aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAlexandros Naskos <alex_naskos@hotmail.com>2020-10-04 10:39:26 +0300
committerAlexandros Naskos <alex_naskos@hotmail.com>2020-10-04 10:39:26 +0300
commit23cd3b33312ea5fcae32dcb6cd53cbd502361ce9 (patch)
treeeae3657140271fb945dae6e4e1ad9c788808ac58 /src/main.zig
parent82f0ede3ad4150a80ab745419664f1dce4a6be9c (diff)
parent8170a3d574a7118a6ee616d1b1258b2e839de173 (diff)
downloadzig-23cd3b33312ea5fcae32dcb6cd53cbd502361ce9.tar.gz
zig-23cd3b33312ea5fcae32dcb6cd53cbd502361ce9.zip
Merge branch 'master' of https://github.com/ziglang/zig into add_some_frees
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index d421322c17..0868839257 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -273,6 +273,7 @@ const usage_build_generic =
\\ -rdynamic Add all symbols to the dynamic symbol table
\\ -rpath [path] Add directory to the runtime library search path
\\ --eh-frame-hdr Enable C++ exception handling by passing --eh-frame-hdr to linker
+ \\ --emit-relocs Enable output of relocation sections for post build tools
\\ -dynamic Force output to be dynamically linked
\\ -static Force output to be statically linked
\\ -Bsymbolic Bind global references locally
@@ -438,6 +439,7 @@ fn buildOutputType(
var use_lld: ?bool = null;
var use_clang: ?bool = null;
var link_eh_frame_hdr = false;
+ var link_emit_relocs = false;
var each_lib_rpath = false;
var libc_paths_file: ?[]const u8 = null;
var machine_code_model: std.builtin.CodeModel = .default;
@@ -838,6 +840,8 @@ fn buildOutputType(
function_sections = true;
} else if (mem.eql(u8, arg, "--eh-frame-hdr")) {
link_eh_frame_hdr = true;
+ } else if (mem.eql(u8, arg, "--emit-relocs")) {
+ link_emit_relocs = true;
} else if (mem.eql(u8, arg, "-Bsymbolic")) {
linker_bind_global_refs_locally = true;
} else if (mem.eql(u8, arg, "--verbose-link")) {
@@ -1206,6 +1210,10 @@ fn buildOutputType(
fatal("translate-c expects exactly 1 source file (found {})", .{c_source_files.items.len});
}
+ if (root_src_file == null and arg_mode == .zig_test) {
+ fatal("one zig source file is required to run `zig test`", .{});
+ }
+
const root_name = if (provided_name) |n| n else blk: {
if (arg_mode == .zig_test) {
break :blk "test";
@@ -1580,6 +1588,7 @@ fn buildOutputType(
.linker_z_nodelete = linker_z_nodelete,
.linker_z_defs = linker_z_defs,
.link_eh_frame_hdr = link_eh_frame_hdr,
+ .link_emit_relocs = link_emit_relocs,
.stack_size_override = stack_size_override,
.strip = strip,
.single_threaded = single_threaded,