| ... | @@ -933,7 +933,12 @@ fn updateTlv( | ... | @@ -933,7 +933,12 @@ fn updateTlv( |
| 933 | { | 933 | { |
| 934 | const gop = try self.tls_variables.getOrPut(gpa, atom_ptr.atom_index); | 934 | const gop = try self.tls_variables.getOrPut(gpa, atom_ptr.atom_index); |
| 935 | assert(!gop.found_existing); // TODO incremental updates | 935 | assert(!gop.found_existing); // TODO incremental updates |
| 936 | gop.value_ptr.* = .{ .symbol_index = sym_index, .code = try gpa.dupe(u8, code) }; | 936 | gop.value_ptr.* = .{ .symbol_index = sym_index }; |
| | 937 | |
| | 938 | // We only store the data for the TLV if it's non-zerofill. |
| | 939 | if (elf_file.shdrs.items[shndx].sh_type != elf.SHT_NOBITS) { |
| | 940 | gop.value_ptr.code = try gpa.dupe(u8, code); |
| | 941 | } |
| 937 | } | 942 | } |
| 938 | | 943 | |
| 939 | { | 944 | { |
| ... | @@ -1514,7 +1519,7 @@ const DeclMetadata = struct { | ... | @@ -1514,7 +1519,7 @@ const DeclMetadata = struct { |
| 1514 | | 1519 | |
| 1515 | const TlsVariable = struct { | 1520 | const TlsVariable = struct { |
| 1516 | symbol_index: Symbol.Index, | 1521 | symbol_index: Symbol.Index, |
| 1517 | code: []const u8, | 1522 | code: []const u8 = &[0]u8{}, |
| 1518 | | 1523 | |
| 1519 | fn deinit(tlv: *TlsVariable, allocator: Allocator) void { | 1524 | fn deinit(tlv: *TlsVariable, allocator: Allocator) void { |
| 1520 | allocator.free(tlv.code); | 1525 | allocator.free(tlv.code); |