| ... | ... | @@ -379,15 +379,8 @@ pub const GotSection = struct { |
| 379 | 379 | pub fn updateStrtab(got: GotSection, elf_file: *Elf) !void { |
| 380 | 380 | const gpa = elf_file.base.allocator; |
| 381 | 381 | for (got.entries.items) |entry| { |
| 382 | | const suffix = switch (entry.tag) { |
| 383 | | .tlsld => "$tlsld", |
| 384 | | .tlsgd => "$tlsgd", |
| 385 | | .got => "$got", |
| 386 | | .gottp => "$gottp", |
| 387 | | .tlsdesc => "$tlsdesc", |
| 388 | | }; |
| 389 | 382 | const symbol = elf_file.symbol(entry.symbol_index); |
| 390 | | const name = try std.fmt.allocPrint(gpa, "{s}{s}", .{ symbol.name(elf_file), suffix }); |
| 383 | const name = try std.fmt.allocPrint(gpa, "{s}${s}", .{ symbol.name(elf_file), @tagName(entry.tag) }); |
| 391 | 384 | defer gpa.free(name); |
| 392 | 385 | _ = try elf_file.strtab.insert(gpa, name); |
| 393 | 386 | } |
| ... | ... | @@ -396,15 +389,8 @@ pub const GotSection = struct { |
| 396 | 389 | pub fn writeSymtab(got: GotSection, elf_file: *Elf, ctx: anytype) !void { |
| 397 | 390 | const gpa = elf_file.base.allocator; |
| 398 | 391 | for (got.entries.items, ctx.ilocal..) |entry, ilocal| { |
| 399 | | const suffix = switch (entry.tag) { |
| 400 | | .tlsld => "$tlsld", |
| 401 | | .tlsgd => "$tlsgd", |
| 402 | | .got => "$got", |
| 403 | | .gottp => "$gottp", |
| 404 | | .tlsdesc => "$tlsdesc", |
| 405 | | }; |
| 406 | 392 | const symbol = elf_file.symbol(entry.symbol_index); |
| 407 | | const name = try std.fmt.allocPrint(gpa, "{s}{s}", .{ symbol.name(elf_file), suffix }); |
| 393 | const name = try std.fmt.allocPrint(gpa, "{s}${s}", .{ symbol.name(elf_file), @tagName(entry.tag) }); |
| 408 | 394 | defer gpa.free(name); |
| 409 | 395 | const st_name = try elf_file.strtab.insert(gpa, name); |
| 410 | 396 | const st_value = switch (entry.tag) { |