aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/link.cpp b/src/link.cpp
index 3f7772bb08..0ae47c8432 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -1651,7 +1651,6 @@ static void construct_linker_job_elf(LinkJob *lj) {
bool is_lib = g->out_type == OutTypeLib;
bool is_dyn_lib = g->is_dynamic && is_lib;
- Buf *soname = nullptr;
if (!g->have_dynamic_link) {
if (g->zig_target->arch == ZigLLVM_arm || g->zig_target->arch == ZigLLVM_armeb ||
g->zig_target->arch == ZigLLVM_thumb || g->zig_target->arch == ZigLLVM_thumbeb)
@@ -1662,15 +1661,13 @@ static void construct_linker_job_elf(LinkJob *lj) {
}
} else if (is_dyn_lib) {
lj->args.append("-shared");
-
- assert(buf_len(&g->bin_file_output_path) != 0);
- soname = buf_sprintf("lib%s.so.%" ZIG_PRI_usize, buf_ptr(g->root_out_name), g->version_major);
}
if (target_requires_pie(g->zig_target) && g->out_type == OutTypeExe) {
lj->args.append("-pie");
}
+ assert(buf_len(&g->bin_file_output_path) != 0);
lj->args.append("-o");
lj->args.append(buf_ptr(&g->bin_file_output_path));
@@ -1740,6 +1737,9 @@ static void construct_linker_job_elf(LinkJob *lj) {
}
if (is_dyn_lib) {
+ Buf *soname = (g->override_soname == nullptr) ?
+ buf_sprintf("lib%s.so.%" ZIG_PRI_usize, buf_ptr(g->root_out_name), g->version_major) :
+ g->override_soname;
lj->args.append("-soname");
lj->args.append(buf_ptr(soname));