aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-10-04 23:16:46 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-10-04 23:16:46 -0700
commit55ac973953da88c3a108398849ee29f797c4ae52 (patch)
treeb01c6bf6a399774ec39a057b1af93f03f82453f0 /src/main.zig
parentd5d48c6f4ea8a16c2fa9dc9b083c1917a3accee0 (diff)
downloadzig-55ac973953da88c3a108398849ee29f797c4ae52.tar.gz
zig-55ac973953da88c3a108398849ee29f797c4ae52.zip
fix each-lib-rpath functionality
It was regressed in 2 ways from the merge of #6250: * it was not being enabled by default when the target OS is native. * we were testing the libfoo.so file path existence with bogus format string ('{}' instead of '{s}') and so it ended up being something like "libstd.HashMap(K,V,...).Entry.so" instead of "libfoo.so". Using {} rather than {s} is a footgun, be careful! Previous functionality is now restored. closes #6523
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index acfe703291..cd8fefce87 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -268,10 +268,11 @@ const usage_build_generic =
\\ -T[script], --script [script] Use a custom linker script
\\ --version-script [path] Provide a version .map file
\\ --dynamic-linker [path] Set the dynamic interpreter path (usually ld.so)
- \\ --each-lib-rpath Add rpath for each used dynamic library
\\ --version [ver] Dynamic library semver
\\ -rdynamic Add all symbols to the dynamic symbol table
\\ -rpath [path] Add directory to the runtime library search path
+ \\ -feach-lib-rpath Ensure adding rpath for each used dynamic library
+ \\ -fno-each-lib-rpath Prevent adding rpath for each used dynamic library
\\ --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
@@ -442,7 +443,7 @@ fn buildOutputType(
var use_clang: ?bool = null;
var link_eh_frame_hdr = false;
var link_emit_relocs = false;
- var each_lib_rpath = false;
+ var each_lib_rpath: ?bool = null;
var libc_paths_file: ?[]const u8 = null;
var machine_code_model: std.builtin.CodeModel = .default;
var runtime_args_start: ?usize = null;
@@ -739,8 +740,10 @@ fn buildOutputType(
if (i + 1 >= args.len) fatal("expected parameter after {}", .{arg});
i += 1;
override_lib_dir = args[i];
- } else if (mem.eql(u8, arg, "--each-lib-rpath")) {
+ } else if (mem.eql(u8, arg, "-feach-lib-rpath")) {
each_lib_rpath = true;
+ } else if (mem.eql(u8, arg, "-fno-each-lib-rpath")) {
+ each_lib_rpath = false;
} else if (mem.eql(u8, arg, "--enable-cache")) {
enable_cache = true;
} else if (mem.eql(u8, arg, "--test-cmd-bin")) {