aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-16 17:01:23 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-16 17:01:23 -0400
commit48de57d8248d9203b44d28d7749b5d7c1a00deba (patch)
tree149fb86d959501ecb2e5e2aac7f688265f729ba6 /src
parentb3a3e2094e8b88e40eecf65d29f39af10442bde4 (diff)
downloadzig-48de57d8248d9203b44d28d7749b5d7c1a00deba.tar.gz
zig-48de57d8248d9203b44d28d7749b5d7c1a00deba.zip
add basic std lib code for loading dynamic libraries
this is going to only work for very basic libraries; I plan to slowly add more features over time to support more complicated libraries
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp12
-rw-r--r--src/link.cpp4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index d05bcba2ce..fedfcfa744 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -6768,7 +6768,7 @@ static void define_builtin_compile_vars(CodeGen *g) {
int err;
Buf *abs_full_path = buf_alloc();
if ((err = os_path_real(builtin_zig_path, abs_full_path))) {
- fprintf(stderr, "unable to open '%s': %s", buf_ptr(builtin_zig_path), err_str(err));
+ fprintf(stderr, "unable to open '%s': %s\n", buf_ptr(builtin_zig_path), err_str(err));
exit(1);
}
@@ -6936,11 +6936,11 @@ static ImportTableEntry *add_special_code(CodeGen *g, PackageTableEntry *package
Buf *abs_full_path = buf_alloc();
int err;
if ((err = os_path_real(&path_to_code_src, abs_full_path))) {
- zig_panic("unable to open '%s': %s", buf_ptr(&path_to_code_src), err_str(err));
+ zig_panic("unable to open '%s': %s\n", buf_ptr(&path_to_code_src), err_str(err));
}
Buf *import_code = buf_alloc();
if ((err = os_fetch_file_path(abs_full_path, import_code, false))) {
- zig_panic("unable to open '%s': %s", buf_ptr(&path_to_code_src), err_str(err));
+ zig_panic("unable to open '%s': %s\n", buf_ptr(&path_to_code_src), err_str(err));
}
return add_source_file(g, package, abs_full_path, import_code);
@@ -7024,13 +7024,13 @@ static void gen_root_source(CodeGen *g) {
Buf *abs_full_path = buf_alloc();
int err;
if ((err = os_path_real(rel_full_path, abs_full_path))) {
- fprintf(stderr, "unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
+ fprintf(stderr, "unable to open '%s': %s\n", buf_ptr(rel_full_path), err_str(err));
exit(1);
}
Buf *source_code = buf_alloc();
if ((err = os_fetch_file_path(rel_full_path, source_code, true))) {
- fprintf(stderr, "unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
+ fprintf(stderr, "unable to open '%s': %s\n", buf_ptr(rel_full_path), err_str(err));
exit(1);
}
@@ -7374,7 +7374,7 @@ static void gen_h_file(CodeGen *g) {
FILE *out_h = fopen(buf_ptr(g->out_h_path), "wb");
if (!out_h)
- zig_panic("unable to open %s: %s", buf_ptr(g->out_h_path), strerror(errno));
+ zig_panic("unable to open %s: %s\n", buf_ptr(g->out_h_path), strerror(errno));
Buf *export_macro = preprocessor_mangle(buf_sprintf("%s_EXPORT", buf_ptr(g->root_out_name)));
buf_upcase(export_macro);
diff --git a/src/link.cpp b/src/link.cpp
index d2925cb5a8..a4631b1daf 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -208,7 +208,7 @@ static Buf *get_dynamic_linker_path(CodeGen *g) {
static void construct_linker_job_elf(LinkJob *lj) {
CodeGen *g = lj->codegen;
- if (lj->link_in_crt) {
+ if (g->libc_link_lib != nullptr) {
find_libc_lib_path(g);
}
@@ -432,7 +432,7 @@ static bool zig_lld_link(ZigLLVM_ObjectFormatType oformat, const char **args, si
static void construct_linker_job_coff(LinkJob *lj) {
CodeGen *g = lj->codegen;
- if (lj->link_in_crt) {
+ if (g->libc_link_lib != nullptr) {
find_libc_lib_path(g);
}