diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-11-15 15:07:09 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-11-15 15:07:09 +0100 |
| commit | 760ce69734e8c6fca02356c53729909ccb5d8ff9 (patch) | |
| tree | f9e0348529eab5458b6db4407aaefe381ef7f711 /src/link/Elf | |
| parent | 0c6cb8d8c80f0a316a77eddfebaa42cb77c8bf7d (diff) | |
| download | zig-760ce69734e8c6fca02356c53729909ccb5d8ff9.tar.gz zig-760ce69734e8c6fca02356c53729909ccb5d8ff9.zip | |
elf: actually write synthetic globals to output symtab
Diffstat (limited to 'src/link/Elf')
| -rw-r--r-- | src/link/Elf/synthetic_sections.zig | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/link/Elf/synthetic_sections.zig b/src/link/Elf/synthetic_sections.zig index 47e72cb1e3..25a9975f01 100644 --- a/src/link/Elf/synthetic_sections.zig +++ b/src/link/Elf/synthetic_sections.zig @@ -917,8 +917,7 @@ pub const PltSection = struct { } pub fn writeSymtab(plt: PltSection, elf_file: *Elf) void { - var ilocal = plt.output_symtab_ctx.ilocal; - for (plt.symbols.items) |sym_index| { + for (plt.symbols.items, plt.output_symtab_ctx.ilocal..) |sym_index, ilocal| { const sym = elf_file.symbol(sym_index); const st_name = @as(u32, @intCast(elf_file.strtab.items.len)); elf_file.strtab.appendSliceAssumeCapacity(sym.name(elf_file)); @@ -932,7 +931,6 @@ pub const PltSection = struct { .st_value = sym.pltAddress(elf_file), .st_size = 16, }; - ilocal += 1; } } @@ -1046,8 +1044,7 @@ pub const PltGotSection = struct { } pub fn writeSymtab(plt_got: PltGotSection, elf_file: *Elf) void { - var ilocal = plt_got.output_symtab_ctx.ilocal; - for (plt_got.symbols.items) |sym_index| { + for (plt_got.symbols.items, plt_got.output_symtab_ctx.ilocal..) |sym_index, ilocal| { const sym = elf_file.symbol(sym_index); const st_name = @as(u32, @intCast(elf_file.strtab.items.len)); elf_file.strtab.appendSliceAssumeCapacity(sym.name(elf_file)); @@ -1061,7 +1058,6 @@ pub const PltGotSection = struct { .st_value = sym.pltGotAddress(elf_file), .st_size = 16, }; - ilocal += 1; } } }; |
