| ... | ... | @@ -1574,7 +1574,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void { |
| 1574 | 1574 | } |
| 1575 | 1575 | } else { |
| 1576 | 1576 | if (!self.isStatic()) { |
| 1577 | | if (self.base.options.dynamic_linker) |path| { |
| 1577 | if (self.base.options.target.dynamic_linker.get()) |path| { |
| 1578 | 1578 | try argv.append("-dynamic-linker"); |
| 1579 | 1579 | try argv.append(path); |
| 1580 | 1580 | } |
| ... | ... | @@ -2374,7 +2374,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 2374 | 2374 | man.hash.addBytes(libc_installation.crt_dir.?); |
| 2375 | 2375 | } |
| 2376 | 2376 | if (have_dynamic_linker) { |
| 2377 | | man.hash.addOptionalBytes(self.base.options.dynamic_linker); |
| 2377 | man.hash.addOptionalBytes(self.base.options.target.dynamic_linker.get()); |
| 2378 | 2378 | } |
| 2379 | 2379 | } |
| 2380 | 2380 | man.hash.addOptionalBytes(self.base.options.soname); |
| ... | ... | @@ -2687,7 +2687,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 2687 | 2687 | } |
| 2688 | 2688 | |
| 2689 | 2689 | if (have_dynamic_linker) { |
| 2690 | | if (self.base.options.dynamic_linker) |dynamic_linker| { |
| 2690 | if (self.base.options.target.dynamic_linker.get()) |dynamic_linker| { |
| 2691 | 2691 | try argv.append("-dynamic-linker"); |
| 2692 | 2692 | try argv.append(dynamic_linker); |
| 2693 | 2693 | } |
| ... | ... | @@ -3503,7 +3503,7 @@ fn initSyntheticSections(self: *Elf) !void { |
| 3503 | 3503 | // a segfault in the dynamic linker trying to load a binary that is static |
| 3504 | 3504 | // and doesn't contain .dynamic section. |
| 3505 | 3505 | if (self.isStatic() and !self.base.options.pie) break :blk false; |
| 3506 | | break :blk self.base.options.dynamic_linker != null; |
| 3506 | break :blk self.base.options.target.dynamic_linker.get() != null; |
| 3507 | 3507 | }; |
| 3508 | 3508 | if (needs_interp) { |
| 3509 | 3509 | self.interp_section_index = try self.addSection(.{ |
| ... | ... | @@ -4244,7 +4244,7 @@ fn updateSectionSizes(self: *Elf) !void { |
| 4244 | 4244 | } |
| 4245 | 4245 | |
| 4246 | 4246 | if (self.interp_section_index) |index| { |
| 4247 | | self.shdrs.items[index].sh_size = self.base.options.dynamic_linker.?.len + 1; |
| 4247 | self.shdrs.items[index].sh_size = self.base.options.target.dynamic_linker.get().?.len + 1; |
| 4248 | 4248 | } |
| 4249 | 4249 | |
| 4250 | 4250 | if (self.hash_section_index) |index| { |
| ... | ... | @@ -4938,14 +4938,14 @@ fn writeSyntheticSections(self: *Elf) !void { |
| 4938 | 4938 | const gpa = self.base.allocator; |
| 4939 | 4939 | |
| 4940 | 4940 | if (self.interp_section_index) |shndx| { |
| 4941 | var buffer: [256]u8 = undefined; |
| 4942 | const interp = self.base.options.target.dynamic_linker.get().?; |
| 4943 | @memcpy(buffer[0..interp.len], interp); |
| 4944 | buffer[interp.len] = 0; |
| 4945 | const contents = buffer[0 .. interp.len + 1]; |
| 4941 | 4946 | const shdr = self.shdrs.items[shndx]; |
| 4942 | | const sh_size = math.cast(usize, shdr.sh_size) orelse return error.Overflow; |
| 4943 | | var buffer = try gpa.alloc(u8, sh_size); |
| 4944 | | defer gpa.free(buffer); |
| 4945 | | const dylinker = self.base.options.dynamic_linker.?; |
| 4946 | | @memcpy(buffer[0..dylinker.len], dylinker); |
| 4947 | | buffer[dylinker.len] = 0; |
| 4948 | | try self.base.file.?.pwriteAll(buffer, shdr.sh_offset); |
| 4947 | assert(shdr.sh_size == contents.len); |
| 4948 | try self.base.file.?.pwriteAll(contents, shdr.sh_offset); |
| 4949 | 4949 | } |
| 4950 | 4950 | |
| 4951 | 4951 | if (self.hash_section_index) |shndx| { |