| ... | ... | @@ -8904,24 +8904,27 @@ fn prelinkInner(elf: *Elf) Error!void { |
| 8904 | 8904 | if (comp.zcu) |_| self_hosted_codegen: { |
| 8905 | 8905 | if (comp.config.use_llvm) break :self_hosted_codegen; |
| 8906 | 8906 | |
| 8907 | | // We're using self-hosted codegen---add an input representing the Zig "object". |
| 8908 | | try elf.inputs.ensureUnusedCapacity(gpa, 1); |
| 8909 | | const zcu_name = try std.fmt.allocPrint(gpa, "{s}_zcu", .{comp.root_name}); |
| 8910 | | defer gpa.free(zcu_name); |
| 8911 | | const zcu_file_symbol = try elf.addLocalSymbol(.{ |
| 8912 | | .node = .none, |
| 8913 | | .name = zcu_name, |
| 8914 | | .value = 0, |
| 8915 | | .size = 0, |
| 8916 | | .type = .FILE, |
| 8917 | | .shndx = .ABS, |
| 8918 | | }); |
| 8919 | | elf.inputs.addOneAssumeCapacity().* = .{ |
| 8920 | | .path = elf.base.emit, |
| 8921 | | .member = null, |
| 8922 | | .extra = .{ .file_symbol = zcu_file_symbol }, |
| 8923 | | }; |
| 8924 | | elf.input_pending_index += 1; |
| 8907 | if (elf.archive == null) { |
| 8908 | // Self-hosted codegen is logically emitting a relocatable which is then immediately |
| 8909 | // being linked into the output file, so add that fictional Zig object file input. |
| 8910 | try elf.inputs.ensureUnusedCapacity(gpa, 1); |
| 8911 | const zcu_name = try std.fmt.allocPrint(gpa, "{s}_zcu", .{comp.root_name}); |
| 8912 | defer gpa.free(zcu_name); |
| 8913 | const zcu_file_symbol = try elf.addLocalSymbol(.{ |
| 8914 | .node = .none, |
| 8915 | .name = zcu_name, |
| 8916 | .value = 0, |
| 8917 | .size = 0, |
| 8918 | .type = .FILE, |
| 8919 | .shndx = .ABS, |
| 8920 | }); |
| 8921 | elf.inputs.addOneAssumeCapacity().* = .{ |
| 8922 | .path = elf.base.emit, |
| 8923 | .member = null, |
| 8924 | .extra = .{ .file_symbol = zcu_file_symbol }, |
| 8925 | }; |
| 8926 | elf.input_pending_index += 1; |
| 8927 | } |
| 8925 | 8928 | |
| 8926 | 8929 | switch (elf.shndx.debug_addr) { |
| 8927 | 8930 | .UNDEF => {}, |