| ... | ... | @@ -1407,26 +1407,7 @@ pub fn getDeclVAddr( |
| 1407 | 1407 | // TODO handle other extern variables and functions |
| 1408 | 1408 | return undefined; |
| 1409 | 1409 | } |
| 1410 | | // we might already know the vaddr |
| 1411 | | if (decl.ty.zigTypeTag(mod) == .Fn) { |
| 1412 | | var start = self.bases.text; |
| 1413 | | var it_file = self.fn_decl_table.iterator(); |
| 1414 | | while (it_file.next()) |fentry| { |
| 1415 | | var symidx_and_submap = fentry.value_ptr; |
| 1416 | | var submap_it = symidx_and_submap.functions.iterator(); |
| 1417 | | while (submap_it.next()) |entry| { |
| 1418 | | if (entry.key_ptr.* == decl_index) return start; |
| 1419 | | start += entry.value_ptr.code.len; |
| 1420 | | } |
| 1421 | | } |
| 1422 | | } else { |
| 1423 | | var start = self.bases.data + self.got_len * if (!self.sixtyfour_bit) @as(u32, 4) else 8; |
| 1424 | | var it = self.data_decl_table.iterator(); |
| 1425 | | while (it.next()) |kv| { |
| 1426 | | if (decl_index == kv.key_ptr.*) return start; |
| 1427 | | start += kv.value_ptr.len; |
| 1428 | | } |
| 1429 | | } |
| 1410 | // otherwise, we just add a relocation |
| 1430 | 1411 | const atom_index = try self.seeDecl(decl_index); |
| 1431 | 1412 | // the parent_atom_index in this case is just the decl_index of the parent |
| 1432 | 1413 | try self.addReloc(reloc_info.parent_atom_index, .{ |