| ... | @@ -87,15 +87,6 @@ pub const DeclState = struct { | ... | @@ -87,15 +87,6 @@ pub const DeclState = struct { |
| 87 | self.exprloc_relocs.deinit(self.gpa); | 87 | self.exprloc_relocs.deinit(self.gpa); |
| 88 | } | 88 | } |
| 89 | | 89 | |
| 90 | fn addExprlocReloc(self: *DeclState, target: u32, offset: u32, is_ptr: bool) !void { | | |
| 91 | log.debug("{x}: target sym %{d}, via GOT {}", .{ offset, target, is_ptr }); | | |
| 92 | try self.exprloc_relocs.append(self.gpa, .{ | | |
| 93 | .type = if (is_ptr) .got_load else .direct_load, | | |
| 94 | .target = target, | | |
| 95 | .offset = offset, | | |
| 96 | }); | | |
| 97 | } | | |
| 98 | | | |
| 99 | /// Adds local type relocation of the form: @offset => @this + addend | 90 | /// Adds local type relocation of the form: @offset => @this + addend |
| 100 | /// @this signifies the offset within the .debug_abbrev section of the containing atom. | 91 | /// @this signifies the offset within the .debug_abbrev section of the containing atom. |
| 101 | fn addTypeRelocLocal(self: *DeclState, atom_index: Atom.Index, offset: u32, addend: u32) !void { | 92 | fn addTypeRelocLocal(self: *DeclState, atom_index: Atom.Index, offset: u32, addend: u32) !void { |
| ... | @@ -807,11 +798,25 @@ pub const DeclState = struct { | ... | @@ -807,11 +798,25 @@ pub const DeclState = struct { |
| 807 | try dbg_info.append(DW.OP.deref); | 798 | try dbg_info.append(DW.OP.deref); |
| 808 | } | 799 | } |
| 809 | switch (loc) { | 800 | switch (loc) { |
| 810 | .linker_load => |load_struct| try self.addExprlocReloc( | 801 | .linker_load => |load_struct| switch (load_struct.type) { |
| 811 | load_struct.sym_index, | 802 | .direct => { |
| 812 | offset, | 803 | log.debug("{x}: target sym %{d}", .{ offset, load_struct.sym_index }); |
| 813 | is_ptr, | 804 | try self.exprloc_relocs.append(self.gpa, .{ |
| 814 | ), | 805 | .type = .direct_load, |
| | 806 | .target = load_struct.sym_index, |
| | 807 | .offset = offset, |
| | 808 | }); |
| | 809 | }, |
| | 810 | .got => { |
| | 811 | log.debug("{x}: target sym %{d} via GOT", .{ offset, load_struct.sym_index }); |
| | 812 | try self.exprloc_relocs.append(self.gpa, .{ |
| | 813 | .type = .got_load, |
| | 814 | .target = load_struct.sym_index, |
| | 815 | .offset = offset, |
| | 816 | }); |
| | 817 | }, |
| | 818 | else => {}, // TODO |
| | 819 | }, |
| 815 | else => {}, | 820 | else => {}, |
| 816 | } | 821 | } |
| 817 | }, | 822 | }, |