aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-07-23 14:32:13 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-07-23 14:32:13 -0400
commit5a919dd82d798c489219ea60a59f1c0ea3fc3956 (patch)
tree4fd8ca25bfa73d842b803353a8aa80a510072829 /src/codegen.cpp
parent10d2f08d376a302bd79e87d17c06922d3145a939 (diff)
parent99153ac0aa390f01091308073b39947c45851ae6 (diff)
downloadzig-5a919dd82d798c489219ea60a59f1c0ea3fc3956.tar.gz
zig-5a919dd82d798c489219ea60a59f1c0ea3fc3956.zip
Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 6e121be270..7420da9797 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -60,6 +60,33 @@ PackageTableEntry *new_anonymous_package(void) {
return new_package("", "");
}
+static const char *symbols_that_llvm_depends_on[] = {
+ "memcpy",
+ "memset",
+ "sqrt",
+ "powi",
+ "sin",
+ "cos",
+ "pow",
+ "exp",
+ "exp2",
+ "log",
+ "log10",
+ "log2",
+ "fma",
+ "fabs",
+ "minnum",
+ "maxnum",
+ "copysign",
+ "floor",
+ "ceil",
+ "trunc",
+ "rint",
+ "nearbyint",
+ "round",
+ // TODO probably all of compiler-rt needs to go here
+};
+
CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out_type, BuildMode build_mode,
Buf *zig_lib_dir)
{
@@ -94,6 +121,10 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out
g->want_h_file = (out_type == OutTypeObj || out_type == OutTypeLib);
buf_resize(&g->global_asm, 0);
+ for (size_t i = 0; i < array_length(symbols_that_llvm_depends_on); i += 1) {
+ g->external_prototypes.put(buf_create_from_str(symbols_that_llvm_depends_on[i]), nullptr);
+ }
+
if (root_src_path) {
Buf *src_basename = buf_alloc();
Buf *src_dir = buf_alloc();