aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-10-13 17:55:36 -0400
committerGitHub <noreply@github.com>2019-10-13 17:55:36 -0400
commitf7f3dedb1de405e0123c93a4a9e54503e02942ee (patch)
tree04f1cd498a30a4a3621c3b9d82f5ebeb44fd5f36 /src/link.cpp
parentb164e0ae5599610e39804845331caab612010c13 (diff)
parent60cf3f8a8c26ad4131c5842238cefe6b45a67d9f (diff)
downloadzig-f7f3dedb1de405e0123c93a4a9e54503e02942ee.tar.gz
zig-f7f3dedb1de405e0123c93a4a9e54503e02942ee.zip
Merge pull request #3436 from LemonBoy/unpatch-lld
Assemble lib files using LLVM tools instead of lld
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/link.cpp b/src/link.cpp
index de35a18f33..61192724f2 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -2054,27 +2054,12 @@ static const char *get_def_lib(CodeGen *parent, const char *name, Buf *def_in_fi
lib_final_path = buf_alloc();
os_path_join(artifact_dir, final_lib_basename, lib_final_path);
- args.resize(0);
- args.append("link");
- coff_append_machine_arg(parent, &args);
- args.append("-lldmingw");
- args.append("-kill-at");
-
- args.append(buf_ptr(buf_sprintf("-DEF:%s", buf_ptr(def_final_path))));
- args.append(buf_ptr(buf_sprintf("-OUT:%s", buf_ptr(lib_final_path))));
-
- if (parent->verbose_link) {
- for (size_t i = 0; i < args.length; i += 1) {
- fprintf(stderr, "%s ", args.at(i));
- }
- fprintf(stderr, "\n");
- }
-
- Buf diag = BUF_INIT;
- ZigLLVM_ObjectFormatType target_ofmt = target_object_format(parent->zig_target);
- if (!zig_lld_link(target_ofmt, args.items, args.length, &diag)) {
- fprintf(stderr, "%s\n", buf_ptr(&diag));
- exit(1);
+ if (ZigLLVMWriteImportLibrary(buf_ptr(def_final_path),
+ parent->zig_target->arch,
+ buf_ptr(lib_final_path),
+ /* kill_at */ true))
+ {
+ zig_panic("link: could not emit %s", buf_ptr(lib_final_path));
}
} else {
// cache hit