Commit 1772dbb503

Jakub Konka <kubkon@jakubkonka.com>
2023-10-07 14:51:33
elf: fix generating .plt.got indirection
1 parent 06f3b38
Changed files (2)
src/link/Elf/Atom.zig
@@ -697,6 +697,8 @@ fn reportUndefined(
 }
 
 pub fn resolveRelocsAlloc(self: Atom, elf_file: *Elf, code: []u8) !void {
+    relocs_log.debug("0x{x}: {s}", .{ self.value, self.name(elf_file) });
+
     const file_ptr = self.file(elf_file).?;
     var stream = std.io.fixedBufferStream(code);
     const cwriter = stream.writer();
src/link/Elf/synthetic_sections.zig
@@ -795,6 +795,8 @@ pub const PltGotSection = struct {
     pub fn addSymbol(plt_got: *PltGotSection, sym_index: Symbol.Index, elf_file: *Elf) !void {
         const index = @as(u32, @intCast(plt_got.symbols.items.len));
         const symbol = elf_file.symbol(sym_index);
+        symbol.flags.has_plt = true;
+        symbol.flags.has_got = true;
         if (symbol.extra(elf_file)) |extra| {
             var new_extra = extra;
             new_extra.plt_got = index;