aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2024-08-15 10:52:06 +0200
committerJakub Konka <kubkon@jakubkonka.com>2024-08-15 10:52:06 +0200
commit79418fa0abe4b19a2fd2fb10cf3c1144b927d10f (patch)
tree90279b7e98da2b5495554d731272691af42392ee /src
parentc79290467f4908c1fc4833d82d397829e92cf838 (diff)
downloadzig-79418fa0abe4b19a2fd2fb10cf3c1144b927d10f.tar.gz
zig-79418fa0abe4b19a2fd2fb10cf3c1144b927d10f.zip
riscv: remove redundant by-symbol-name check; just check for PIC and extern ptr
Diffstat (limited to 'src')
-rw-r--r--src/arch/riscv64/Emit.zig8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/arch/riscv64/Emit.zig b/src/arch/riscv64/Emit.zig
index 8b32f1e580..a4fadad526 100644
--- a/src/arch/riscv64/Emit.zig
+++ b/src/arch/riscv64/Emit.zig
@@ -49,12 +49,8 @@ pub fn emitMir(emit: *Emit) Error!void {
const atom_ptr = zo.symbol(symbol.atom_index).atom(elf_file).?;
const sym = zo.symbol(symbol.sym_index);
- if (sym.flags.is_extern_ptr) blk: {
- const name = sym.name(elf_file);
- if (mem.eql(u8, "__init_array_start", name) or mem.eql(u8, "__init_array_end", name) or
- mem.eql(u8, "__fini_array_start", name) or mem.eql(u8, "__fini_array_end", name))
- break :blk;
- return emit.fail("emit GOT relocation for symbol '{s}'", .{name});
+ if (sym.flags.is_extern_ptr and emit.lower.pic) {
+ return emit.fail("emit GOT relocation for symbol '{s}'", .{sym.name(elf_file)});
}
const hi_r_type: u32 = @intFromEnum(std.elf.R_RISCV.HI20);