| author | |
| committer | |
| log | 20c36949e1d82e9e8790ca51a0f7713f6e853ff0 |
| tree | 0c8f23358aeb2ba28083ddbf617df1ed90a9528a |
| parent | 5d2edac12dc9eec626977a5bf9b0630504b28c15 |
| signature |
disable failing thread local variable test.
see #20636 files changed, 27 insertions(+), 7 deletions(-)
src/codegen.cpp+10-3| ... | @@ -7288,7 +7288,7 @@ static bool detect_dynamic_link(CodeGen *g) { | ... | @@ -7288,7 +7288,7 @@ static bool detect_dynamic_link(CodeGen *g) { |
| 7288 | return true; | 7288 | return true; |
| 7289 | if (g->zig_target->os == OsFreestanding) | 7289 | if (g->zig_target->os == OsFreestanding) |
| 7290 | return false; | 7290 | return false; |
| 7291 | if (target_requires_pic(g->zig_target)) | 7291 | if (target_requires_pic(g->zig_target, g->libc_link_lib != nullptr)) |
| 7292 | return true; | 7292 | return true; |
| 7293 | if (g->out_type == OutTypeExe) { | 7293 | if (g->out_type == OutTypeExe) { |
| 7294 | // If there are no dynamic libraries then we can disable PIC | 7294 | // If there are no dynamic libraries then we can disable PIC |
| ... | @@ -7304,7 +7304,7 @@ static bool detect_dynamic_link(CodeGen *g) { | ... | @@ -7304,7 +7304,7 @@ static bool detect_dynamic_link(CodeGen *g) { |
| 7304 | } | 7304 | } |
| 7305 | 7305 | ||
| 7306 | static bool detect_pic(CodeGen *g) { | 7306 | static bool detect_pic(CodeGen *g) { |
| 7307 | if (target_requires_pic(g->zig_target)) | 7307 | if (target_requires_pic(g->zig_target, g->libc_link_lib != nullptr)) |
| 7308 | return true; | 7308 | return true; |
| 7309 | switch (g->want_pic) { | 7309 | switch (g->want_pic) { |
| 7310 | case WantPICDisabled: | 7310 | case WantPICDisabled: |
| ... | @@ -7848,7 +7848,14 @@ static void init(CodeGen *g) { | ... | @@ -7848,7 +7848,14 @@ static void init(CodeGen *g) { |
| 7848 | bool is_optimized = g->build_mode != BuildModeDebug; | 7848 | bool is_optimized = g->build_mode != BuildModeDebug; |
| 7849 | LLVMCodeGenOptLevel opt_level = is_optimized ? LLVMCodeGenLevelAggressive : LLVMCodeGenLevelNone; | 7849 | LLVMCodeGenOptLevel opt_level = is_optimized ? LLVMCodeGenLevelAggressive : LLVMCodeGenLevelNone; |
| 7850 | 7850 | ||
| 7851 | LLVMRelocMode reloc_mode = g->have_pic ? LLVMRelocPIC: LLVMRelocStatic; | 7851 | LLVMRelocMode reloc_mode; |
| 7852 | if (g->have_pic) { | ||
| 7853 | reloc_mode = LLVMRelocPIC; | ||
| 7854 | } else if (g->have_dynamic_link) { | ||
| 7855 | reloc_mode = LLVMRelocDynamicNoPic; | ||
| 7856 | } else { | ||
| 7857 | reloc_mode = LLVMRelocStatic; | ||
| 7858 | } | ||
| 7852 | 7859 | ||
| 7853 | const char *target_specific_cpu_args; | 7860 | const char *target_specific_cpu_args; |
| 7854 | const char *target_specific_features; | 7861 | const char *target_specific_features; |
src/main.cpp+4-1| ... | @@ -417,6 +417,7 @@ int main(int argc, char **argv) { | ... | @@ -417,6 +417,7 @@ int main(int argc, char **argv) { |
| 417 | ZigList<const char *> link_libs = {0}; | 417 | ZigList<const char *> link_libs = {0}; |
| 418 | ZigList<const char *> forbidden_link_libs = {0}; | 418 | ZigList<const char *> forbidden_link_libs = {0}; |
| 419 | ZigList<const char *> frameworks = {0}; | 419 | ZigList<const char *> frameworks = {0}; |
| 420 | bool have_libc = false; | ||
| 420 | const char *target_string = nullptr; | 421 | const char *target_string = nullptr; |
| 421 | bool rdynamic = false; | 422 | bool rdynamic = false; |
| 422 | const char *mmacosx_version_min = nullptr; | 423 | const char *mmacosx_version_min = nullptr; |
| ... | @@ -745,6 +746,8 @@ int main(int argc, char **argv) { | ... | @@ -745,6 +746,8 @@ int main(int argc, char **argv) { |
| 745 | } else if (strcmp(arg, "--library-path") == 0 || strcmp(arg, "-L") == 0) { | 746 | } else if (strcmp(arg, "--library-path") == 0 || strcmp(arg, "-L") == 0) { |
| 746 | lib_dirs.append(argv[i]); | 747 | lib_dirs.append(argv[i]); |
| 747 | } else if (strcmp(arg, "--library") == 0) { | 748 | } else if (strcmp(arg, "--library") == 0) { |
| 749 | if (strcmp(argv[i], "c") == 0) | ||
| 750 | have_libc = true; | ||
| 748 | link_libs.append(argv[i]); | 751 | link_libs.append(argv[i]); |
| 749 | } else if (strcmp(arg, "--forbid-library") == 0) { | 752 | } else if (strcmp(arg, "--forbid-library") == 0) { |
| 750 | forbidden_link_libs.append(argv[i]); | 753 | forbidden_link_libs.append(argv[i]); |
| ... | @@ -911,7 +914,7 @@ int main(int argc, char **argv) { | ... | @@ -911,7 +914,7 @@ int main(int argc, char **argv) { |
| 911 | return print_error_usage(arg0); | 914 | return print_error_usage(arg0); |
| 912 | } | 915 | } |
| 913 | 916 | ||
| 914 | if (target_requires_pic(&target) && want_pic == WantPICDisabled) { | 917 | if (target_requires_pic(&target, have_libc) && want_pic == WantPICDisabled) { |
| 915 | Buf triple_buf = BUF_INIT; | 918 | Buf triple_buf = BUF_INIT; |
| 916 | get_target_triple(&triple_buf, &target); | 919 | get_target_triple(&triple_buf, &target); |
| 917 | fprintf(stderr, "`--disable-pic` is incompatible with target '%s'\n", buf_ptr(&triple_buf)); | 920 | fprintf(stderr, "`--disable-pic` is incompatible with target '%s'\n", buf_ptr(&triple_buf)); |
src/target.cpp+3-2| ... | @@ -1300,9 +1300,10 @@ bool target_supports_fpic(const ZigTarget *target) { | ... | @@ -1300,9 +1300,10 @@ bool target_supports_fpic(const ZigTarget *target) { |
| 1300 | return target->os != OsWindows; | 1300 | return target->os != OsWindows; |
| 1301 | } | 1301 | } |
| 1302 | 1302 | ||
| 1303 | bool target_requires_pic(const ZigTarget *target) { | 1303 | bool target_requires_pic(const ZigTarget *target, bool linking_libc) { |
| 1304 | // This function returns whether non-pic code is completely invalid on the given target. | 1304 | // This function returns whether non-pic code is completely invalid on the given target. |
| 1305 | return target->os == OsWindows || target_os_requires_libc(target->os) || target_is_glibc(target); | 1305 | return target->os == OsWindows || target_os_requires_libc(target->os) || |
| 1306 | (linking_libc && target_is_glibc(target)); | ||
| 1306 | } | 1307 | } |
| 1307 | 1308 | ||
| 1308 | bool target_is_glibc(const ZigTarget *target) { | 1309 | bool target_is_glibc(const ZigTarget *target) { |
src/target.hpp+1-1| ... | @@ -161,7 +161,7 @@ bool target_can_build_libc(const ZigTarget *target); | ... | @@ -161,7 +161,7 @@ bool target_can_build_libc(const ZigTarget *target); |
| 161 | const char *target_libc_generic_name(const ZigTarget *target); | 161 | const char *target_libc_generic_name(const ZigTarget *target); |
| 162 | bool target_is_libc_lib_name(const ZigTarget *target, const char *name); | 162 | bool target_is_libc_lib_name(const ZigTarget *target, const char *name); |
| 163 | bool target_supports_fpic(const ZigTarget *target); | 163 | bool target_supports_fpic(const ZigTarget *target); |
| 164 | bool target_requires_pic(const ZigTarget *target); | 164 | bool target_requires_pic(const ZigTarget *target, bool linking_libc); |
| 165 | bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi); | 165 | bool target_abi_is_gnu(ZigLLVM_EnvironmentType abi); |
| 166 | bool target_abi_is_musl(ZigLLVM_EnvironmentType abi); | 166 | bool target_abi_is_musl(ZigLLVM_EnvironmentType abi); |
| 167 | bool target_is_glibc(const ZigTarget *target); | 167 | bool target_is_glibc(const ZigTarget *target); |
std/os/test.zig+4| ... | @@ -108,6 +108,10 @@ test "AtomicFile" { | ... | @@ -108,6 +108,10 @@ test "AtomicFile" { |
| 108 | 108 | ||
| 109 | test "thread local storage" { | 109 | test "thread local storage" { |
| 110 | if (builtin.single_threaded) return error.SkipZigTest; | 110 | if (builtin.single_threaded) return error.SkipZigTest; |
| 111 | if (!builtin.position_independent_code and !builtin.link_libc) { | ||
| 112 | // TODO https://github.com/ziglang/zig/issues/2063 | ||
| 113 | return error.SkipZigTest; | ||
| 114 | } | ||
| 111 | const thread1 = try std.os.spawnThread({}, testTls); | 115 | const thread1 = try std.os.spawnThread({}, testTls); |
| 112 | const thread2 = try std.os.spawnThread({}, testTls); | 116 | const thread2 = try std.os.spawnThread({}, testTls); |
| 113 | testTls({}); | 117 | testTls({}); |
test/stage1/behavior/misc.zig+5| ... | @@ -688,6 +688,11 @@ fn getNull() ?*i32 { | ... | @@ -688,6 +688,11 @@ fn getNull() ?*i32 { |
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | test "thread local variable" { | 690 | test "thread local variable" { |
| 691 | if (!builtin.position_independent_code and !builtin.link_libc) { | ||
| 692 | // TODO https://github.com/ziglang/zig/issues/2063 | ||
| 693 | return error.SkipZigTest; | ||
| 694 | } | ||
| 695 | |||
| 691 | const S = struct { | 696 | const S = struct { |
| 692 | threadlocal var t: i32 = 1234; | 697 | threadlocal var t: i32 = 1234; |
| 693 | }; | 698 | }; |