mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
elf+aarch64: fix incorrectly emitted TLSDESC relocs
This commit is contained in:
parent
b5642b4f85
commit
7258d143e3
@ -634,8 +634,17 @@ pub const GotSection = struct {
|
||||
}
|
||||
},
|
||||
.tlsdesc => {
|
||||
try writeInt(0, elf_file, writer);
|
||||
try writeInt(0, elf_file, writer);
|
||||
if (symbol.?.flags.import) {
|
||||
try writeInt(0, elf_file, writer);
|
||||
try writeInt(0, elf_file, writer);
|
||||
} else {
|
||||
try writeInt(0, elf_file, writer);
|
||||
const offset = if (apply_relocs)
|
||||
@as(i64, @intCast(symbol.?.address(.{}, elf_file))) - @as(i64, @intCast(elf_file.tlsAddress()))
|
||||
else
|
||||
0;
|
||||
try writeInt(offset, elf_file, writer);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -738,8 +747,9 @@ pub const GotSection = struct {
|
||||
const offset = symbol.?.tlsDescAddress(elf_file);
|
||||
elf_file.addRelaDynAssumeCapacity(.{
|
||||
.offset = offset,
|
||||
.sym = extra.?.dynamic,
|
||||
.sym = if (symbol.?.flags.import) extra.?.dynamic else 0,
|
||||
.type = relocation.encode(.tlsdesc, cpu_arch),
|
||||
.addend = if (symbol.?.flags.import) 0 else @intCast(symbol.?.address(.{}, elf_file) - elf_file.tlsAddress()),
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user