| author | |
| committer | |
| log | 8a0cb7002e6b8f7b50fdf7ee40311ce93fbef009 |
| tree | a3a0aa5bdd1c02cb4b8193000f1c3b1b9c6f1ae5 |
| parent | 2e8351cc9e30c28a9415821ed99d664b76eb2062 |
4 files changed, 11 insertions(+), 11 deletions(-)
src/arch/x86_64/Emit.zig+2-2| ... | ... | @@ -114,7 +114,7 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 114 | 114 | const atom = zo.symbol(data.atom_index).atom(elf_file).?; |
| 115 | 115 | const sym = zo.symbol(data.sym_index); |
| 116 | 116 | if (emit.lower.pic) { |
| 117 | const r_type: u32 = if (sym.flags.needs_got) | |
| 117 | const r_type: u32 = if (sym.flags.is_extern_ptr) | |
| 118 | 118 | @intFromEnum(std.elf.R_X86_64.GOTPCREL) |
| 119 | 119 | else |
| 120 | 120 | @intFromEnum(std.elf.R_X86_64.PC32); |
| ... | ... | @@ -124,7 +124,7 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 124 | 124 | .r_addend = -4, |
| 125 | 125 | }); |
| 126 | 126 | } else { |
| 127 | const r_type: u32 = if (sym.flags.needs_got) | |
| 127 | const r_type: u32 = if (sym.flags.is_extern_ptr) | |
| 128 | 128 | @intFromEnum(std.elf.R_X86_64.GOT32) |
| 129 | 129 | else if (sym.flags.is_tls) |
| 130 | 130 | @intFromEnum(std.elf.R_X86_64.TPOFF32) |
src/codegen.zig+1-2| ... | ... | @@ -898,9 +898,8 @@ fn genNavRef( |
| 898 | 898 | if (lf.cast(.elf)) |elf_file| { |
| 899 | 899 | const zo = elf_file.zigObjectPtr().?; |
| 900 | 900 | if (is_extern) { |
| 901 | // TODO audit this | |
| 902 | 901 | const sym_index = try elf_file.getGlobalSymbol(name.toSlice(ip), lib_name.toSlice(ip)); |
| 903 | zo.symbol(sym_index).flags.needs_got = true; | |
| 902 | zo.symbol(sym_index).flags.is_extern_ptr = true; | |
| 904 | 903 | return GenResult.mcv(.{ .load_symbol = sym_index }); |
| 905 | 904 | } |
| 906 | 905 | const sym_index = try zo.getOrCreateMetadataForNav(elf_file, nav_index); |
src/link/Elf/Symbol.zig+7-5| ... | ... | @@ -447,16 +447,18 @@ pub const Flags = packed struct { |
| 447 | 447 | needs_tlsdesc: bool = false, |
| 448 | 448 | has_tlsdesc: bool = false, |
| 449 | 449 | |
| 450 | /// Whether the symbol is a TLS variable. | |
| 451 | /// TODO this is really not needed if only we operated on esyms between | |
| 452 | /// codegen and ZigObject. | |
| 453 | is_tls: bool = false, | |
| 454 | ||
| 455 | 450 | /// Whether the symbol is a merge subsection. |
| 456 | 451 | merge_subsection: bool = false, |
| 457 | 452 | |
| 453 | /// ZigObject specific flags | |
| 458 | 454 | /// Whether the symbol has a trampoline. |
| 459 | 455 | has_trampoline: bool = false, |
| 456 | ||
| 457 | /// Whether the symbol is a TLS variable. | |
| 458 | is_tls: bool = false, | |
| 459 | ||
| 460 | /// Whether the symbol is an extern pointer (as opposed to function). | |
| 461 | is_extern_ptr: bool = false, | |
| 460 | 462 | }; |
| 461 | 463 | |
| 462 | 464 | pub const Extra = struct { |
src/link/Elf/ZigObject.zig+1-2| ... | ... | @@ -1141,13 +1141,12 @@ pub fn updateNav( |
| 1141 | 1141 | .variable => |variable| Value.fromInterned(variable.init), |
| 1142 | 1142 | .@"extern" => |@"extern"| { |
| 1143 | 1143 | if (ip.isFunctionType(@"extern".ty)) return; |
| 1144 | // Extern variable gets a .got entry only. | |
| 1145 | 1144 | const sym_index = try self.getGlobalSymbol( |
| 1146 | 1145 | elf_file, |
| 1147 | 1146 | nav.name.toSlice(ip), |
| 1148 | 1147 | @"extern".lib_name.toSlice(ip), |
| 1149 | 1148 | ); |
| 1150 | self.symbol(sym_index).flags.needs_got = true; | |
| 1149 | self.symbol(sym_index).flags.is_extern_ptr = true; | |
| 1151 | 1150 | return; |
| 1152 | 1151 | }, |
| 1153 | 1152 | else => nav_val, |