| ... | ... | @@ -724,26 +724,25 @@ fn getDeclOutputSection( |
| 724 | 724 | _ = self; |
| 725 | 725 | const mod = macho_file.base.comp.module.?; |
| 726 | 726 | const any_non_single_threaded = macho_file.base.comp.config.any_non_single_threaded; |
| 727 | | _ = any_non_single_threaded; |
| 728 | 727 | const sect_id: u8 = switch (decl.ty.zigTypeTag(mod)) { |
| 729 | 728 | .Fn => macho_file.zig_text_sect_index.?, |
| 730 | 729 | else => blk: { |
| 731 | 730 | if (decl.getOwnedVariable(mod)) |variable| { |
| 732 | | // if (variable.is_threadlocal and any_non_single_threaded) { |
| 733 | | // const is_all_zeroes = for (code) |byte| { |
| 734 | | // if (byte != 0) break false; |
| 735 | | // } else true; |
| 736 | | // if (is_all_zeroes) break :blk macho_file.getSectionByName("__DATA", "__thread_bss") orelse try macho_file.addSection( |
| 737 | | // "__DATA", |
| 738 | | // "__thread_bss", |
| 739 | | // .{ .flags = macho.S_THREAD_LOCAL_ZEROFILL }, |
| 740 | | // ); |
| 741 | | // break :blk macho_file.getSectionByName("__DATA", "__thread_data") orelse try macho_file.addSection( |
| 742 | | // "__DATA", |
| 743 | | // "__thread_data", |
| 744 | | // .{ .flags = macho.S_THREAD_LOCAL_REGULAR }, |
| 745 | | // ); |
| 746 | | // } |
| 731 | if (variable.is_threadlocal and any_non_single_threaded) { |
| 732 | const is_all_zeroes = for (code) |byte| { |
| 733 | if (byte != 0) break false; |
| 734 | } else true; |
| 735 | if (is_all_zeroes) break :blk macho_file.getSectionByName("__DATA", "__thread_bss") orelse try macho_file.addSection( |
| 736 | "__DATA", |
| 737 | "__thread_bss", |
| 738 | .{ .flags = macho.S_THREAD_LOCAL_ZEROFILL }, |
| 739 | ); |
| 740 | break :blk macho_file.getSectionByName("__DATA", "__thread_data") orelse try macho_file.addSection( |
| 741 | "__DATA", |
| 742 | "__thread_data", |
| 743 | .{ .flags = macho.S_THREAD_LOCAL_REGULAR }, |
| 744 | ); |
| 745 | } |
| 747 | 746 | |
| 748 | 747 | if (variable.is_const) break :blk macho_file.zig_const_sect_index.?; |
| 749 | 748 | if (Value.fromInterned(variable.init).isUndefDeep(mod)) { |
| ... | ... | @@ -1112,17 +1111,15 @@ pub fn getOrCreateMetadataForDecl( |
| 1112 | 1111 | const gop = try self.decls.getOrPut(gpa, decl_index); |
| 1113 | 1112 | if (!gop.found_existing) { |
| 1114 | 1113 | const any_non_single_threaded = macho_file.base.comp.config.any_non_single_threaded; |
| 1115 | | _ = any_non_single_threaded; |
| 1116 | 1114 | const sym_index = try self.addAtom(macho_file); |
| 1117 | 1115 | const mod = macho_file.base.comp.module.?; |
| 1118 | 1116 | const decl = mod.declPtr(decl_index); |
| 1119 | | _ = decl; |
| 1120 | 1117 | const sym = macho_file.getSymbol(sym_index); |
| 1121 | | // if (decl.getOwnedVariable(mod)) |variable| { |
| 1122 | | // if (variable.is_threadlocal and any_non_single_threaded) { |
| 1123 | | // sym.flags.tlv = true; |
| 1124 | | // } |
| 1125 | | // } |
| 1118 | if (decl.getOwnedVariable(mod)) |variable| { |
| 1119 | if (variable.is_threadlocal and any_non_single_threaded) { |
| 1120 | sym.flags.tlv = true; |
| 1121 | } |
| 1122 | } |
| 1126 | 1123 | if (!sym.flags.tlv) { |
| 1127 | 1124 | sym.flags.needs_zig_got = true; |
| 1128 | 1125 | } |