diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-03-13 23:15:34 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-03-13 23:15:34 -0400 |
| commit | 20c36949e1d82e9e8790ca51a0f7713f6e853ff0 (patch) | |
| tree | 0c8f23358aeb2ba28083ddbf617df1ed90a9528a /src/codegen.cpp | |
| parent | 5d2edac12dc9eec626977a5bf9b0630504b28c15 (diff) | |
| download | zig-20c36949e1d82e9e8790ca51a0f7713f6e853ff0.tar.gz zig-20c36949e1d82e9e8790ca51a0f7713f6e853ff0.zip | |
fix target_requires_pic and reloc_mode
disable failing thread local variable test.
see #2063
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 11a368cda6..44e66c4dd8 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -7288,7 +7288,7 @@ static bool detect_dynamic_link(CodeGen *g) { return true; if (g->zig_target->os == OsFreestanding) return false; - if (target_requires_pic(g->zig_target)) + if (target_requires_pic(g->zig_target, g->libc_link_lib != nullptr)) return true; if (g->out_type == OutTypeExe) { // If there are no dynamic libraries then we can disable PIC @@ -7304,7 +7304,7 @@ static bool detect_dynamic_link(CodeGen *g) { } static bool detect_pic(CodeGen *g) { - if (target_requires_pic(g->zig_target)) + if (target_requires_pic(g->zig_target, g->libc_link_lib != nullptr)) return true; switch (g->want_pic) { case WantPICDisabled: @@ -7848,7 +7848,14 @@ static void init(CodeGen *g) { bool is_optimized = g->build_mode != BuildModeDebug; LLVMCodeGenOptLevel opt_level = is_optimized ? LLVMCodeGenLevelAggressive : LLVMCodeGenLevelNone; - LLVMRelocMode reloc_mode = g->have_pic ? LLVMRelocPIC: LLVMRelocStatic; + LLVMRelocMode reloc_mode; + if (g->have_pic) { + reloc_mode = LLVMRelocPIC; + } else if (g->have_dynamic_link) { + reloc_mode = LLVMRelocDynamicNoPic; + } else { + reloc_mode = LLVMRelocStatic; + } const char *target_specific_cpu_args; const char *target_specific_features; |
