elf: make .zig.rodata writeable

This commit is contained in:
Jakub Konka 2023-10-15 09:08:14 +02:00
parent 17635e4f2a
commit c71a79f618
2 changed files with 3 additions and 1 deletions

View File

@ -770,6 +770,7 @@ pub fn initMetadata(self: *Elf) !void {
self.zig_rodata_section_index = try self.allocateAllocSection(.{
.name = ".zig.rodata",
.phdr_index = self.phdr_zig_load_ro_index.?,
.flags = elf.SHF_ALLOC | elf.SHF_WRITE, // TODO rename this section to .data.rel.ro
});
try self.last_atom_and_free_list_table.putNoClobber(gpa, self.zig_rodata_section_index.?, .{});
}

View File

@ -757,12 +757,13 @@ pub fn resolveRelocsAlloc(self: Atom, elf_file: *Elf, code: []u8) !void {
// Address of the dynamic thread pointer.
const DTP = @as(i64, @intCast(elf_file.dtpAddress()));
relocs_log.debug(" {s}: {x}: [{x} => {x}] G({x}) ({s})", .{
relocs_log.debug(" {s}: {x}: [{x} => {x}] G({x}) ZG({x}) ({s})\n", .{
fmtRelocType(r_type),
r_offset,
P,
S + A,
G + GOT + A,
ZIG_GOT + A,
target.name(elf_file),
});