| ... | ... | @@ -1053,7 +1053,7 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 1053 | 1053 | try self.scanRelocs(); |
| 1054 | 1054 | |
| 1055 | 1055 | // Allocate atoms parsed from input object files |
| 1056 | | self.allocateObjects(); |
| 1056 | try self.allocateObjects(); |
| 1057 | 1057 | self.allocateLinkerDefinedSymbols(); |
| 1058 | 1058 | |
| 1059 | 1059 | // Beyond this point, everything has been allocated a virtual address and we can resolve |
| ... | ... | @@ -1405,8 +1405,22 @@ fn scanRelocs(self: *Elf) !void { |
| 1405 | 1405 | } |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | | fn allocateObjects(self: *Elf) void { |
| 1409 | | _ = self; |
| 1408 | fn allocateObjects(self: *Elf) !void { |
| 1409 | for (self.objects.items) |index| { |
| 1410 | const object = self.file(index).?.object; |
| 1411 | for (object.atoms.items) |atom_index| { |
| 1412 | const atom_ptr = self.atom(atom_index) orelse continue; |
| 1413 | if (!atom_ptr.alive) continue; |
| 1414 | try atom_ptr.allocate(self); |
| 1415 | } |
| 1416 | |
| 1417 | for (object.globals()) |global_index| { |
| 1418 | const global = self.symbol(global_index); |
| 1419 | if (global.file_index == index) { |
| 1420 | global.value = global.atom(self).?.value; |
| 1421 | } |
| 1422 | } |
| 1423 | } |
| 1410 | 1424 | } |
| 1411 | 1425 | |
| 1412 | 1426 | fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !void { |