| ... | @@ -234,11 +234,24 @@ pub fn getDeclVAddr( | ... | @@ -234,11 +234,24 @@ pub fn getDeclVAddr( |
| 234 | decl_index: InternPool.DeclIndex, | 234 | decl_index: InternPool.DeclIndex, |
| 235 | reloc_info: link.File.RelocInfo, | 235 | reloc_info: link.File.RelocInfo, |
| 236 | ) !u64 { | 236 | ) !u64 { |
| 237 | _ = self; | 237 | const sym_index = try self.getOrCreateMetadataForDecl(macho_file, decl_index); |
| 238 | _ = macho_file; | 238 | const sym = macho_file.getSymbol(sym_index); |
| 239 | _ = decl_index; | 239 | const vaddr = sym.getAddress(.{}, macho_file); |
| 240 | _ = reloc_info; | 240 | const parent_atom = macho_file.getSymbol(reloc_info.parent_atom_index).getAtom(macho_file).?; |
| 241 | @panic("TODO getDeclVAddr"); | 241 | try parent_atom.addReloc(macho_file, .{ |
| | 242 | .tag = .@"extern", |
| | 243 | .offset = @intCast(reloc_info.offset), |
| | 244 | .target = sym.nlist_idx, |
| | 245 | .addend = reloc_info.addend, |
| | 246 | .type = .unsigned, |
| | 247 | .meta = .{ |
| | 248 | .pcrel = false, |
| | 249 | .has_subtractor = false, |
| | 250 | .length = 3, |
| | 251 | .symbolnum = @intCast(sym.nlist_idx), |
| | 252 | }, |
| | 253 | }); |
| | 254 | return vaddr; |
| 242 | } | 255 | } |
| 243 | | 256 | |
| 244 | pub fn getAnonDeclVAddr( | 257 | pub fn getAnonDeclVAddr( |
| ... | @@ -247,11 +260,24 @@ pub fn getAnonDeclVAddr( | ... | @@ -247,11 +260,24 @@ pub fn getAnonDeclVAddr( |
| 247 | decl_val: InternPool.Index, | 260 | decl_val: InternPool.Index, |
| 248 | reloc_info: link.File.RelocInfo, | 261 | reloc_info: link.File.RelocInfo, |
| 249 | ) !u64 { | 262 | ) !u64 { |
| 250 | _ = self; | 263 | const sym_index = self.anon_decls.get(decl_val).?.symbol_index; |
| 251 | _ = macho_file; | 264 | const sym = macho_file.getSymbol(sym_index); |
| 252 | _ = decl_val; | 265 | const vaddr = sym.getAddress(.{}, macho_file); |
| 253 | _ = reloc_info; | 266 | const parent_atom = macho_file.getSymbol(reloc_info.parent_atom_index).getAtom(macho_file).?; |
| 254 | @panic("TODO getAnonDeclVAddr"); | 267 | try parent_atom.addReloc(macho_file, .{ |
| | 268 | .tag = .@"extern", |
| | 269 | .offset = @intCast(reloc_info.offset), |
| | 270 | .target = sym.nlist_idx, |
| | 271 | .addend = reloc_info.addend, |
| | 272 | .type = .unsigned, |
| | 273 | .meta = .{ |
| | 274 | .pcrel = false, |
| | 275 | .has_subtractor = false, |
| | 276 | .length = 3, |
| | 277 | .symbolnum = @intCast(sym.nlist_idx), |
| | 278 | }, |
| | 279 | }); |
| | 280 | return vaddr; |
| 255 | } | 281 | } |
| 256 | | 282 | |
| 257 | pub fn lowerAnonDecl( | 283 | pub fn lowerAnonDecl( |