aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-10-09 12:18:09 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-10-09 13:16:50 -0400
commit6b93495792678bd00a6205967bb2704a9a35e9c7 (patch)
tree9dd12653140fd7943c7d09dce22b0367a0caa73c /src/codegen.cpp
parent5a3c02137e6a15d3b8c1fb3595d55003ea44139a (diff)
downloadzig-6b93495792678bd00a6205967bb2704a9a35e9c7.tar.gz
zig-6b93495792678bd00a6205967bb2704a9a35e9c7.zip
more efficient builtin library code generation
* introduce --disable-pic option which can generally be allowed to be the default. compiler_rt.a and builtin.a get this option when you build a static executable. * compiler_rt and builtin libraries are not built for build-lib --static * posix_spawn instead of fork/execv * disable the error limit on LLD. Fixes the blank lines printed
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index fd7a386078..02105b4d2a 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -7228,7 +7228,10 @@ static void init(CodeGen *g) {
bool is_optimized = g->build_mode != BuildModeDebug;
LLVMCodeGenOptLevel opt_level = is_optimized ? LLVMCodeGenLevelAggressive : LLVMCodeGenLevelNone;
- LLVMRelocMode reloc_mode = g->is_static ? LLVMRelocStatic : LLVMRelocPIC;
+ if (g->out_type == OutTypeExe && g->is_static) {
+ g->disable_pic = true;
+ }
+ LLVMRelocMode reloc_mode = g->disable_pic ? LLVMRelocStatic : LLVMRelocPIC;
const char *target_specific_cpu_args;
const char *target_specific_features;
@@ -8047,6 +8050,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) {
cache_bool(ch, g->linker_rdynamic);
cache_bool(ch, g->no_rosegment_workaround);
cache_bool(ch, g->each_lib_rpath);
+ cache_bool(ch, g->disable_pic);
cache_buf_opt(ch, g->mmacosx_version_min);
cache_buf_opt(ch, g->mios_version_min);
cache_usize(ch, g->version_major);