| author | |
| committer | |
| log | afe2fed34dd960afb44f88cfe6ce088e1817cb5b |
| tree | a83b5824089c293bf133e5ccab81e342a5972471 |
| parent | cd8c92fc40993d307e891be27bfd86574c2ce85d |
| signature |
If this isn't done, LTO can completely miscompile the input bitcode modules for
certain targets where we need to explicitly set these ABIs (because LLVM's
defaults are bad).2 files changed, 19 insertions(+), 0 deletions(-)
src/link/Coff.zig+7| ... | @@ -1876,6 +1876,13 @@ fn linkWithLLD(coff: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: | ... | @@ -1876,6 +1876,13 @@ fn linkWithLLD(coff: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: |
| 1876 | if (comp.version) |version| { | 1876 | if (comp.version) |version| { |
| 1877 | try argv.append(try allocPrint(arena, "-VERSION:{}.{}", .{ version.major, version.minor })); | 1877 | try argv.append(try allocPrint(arena, "-VERSION:{}.{}", .{ version.major, version.minor })); |
| 1878 | } | 1878 | } |
| 1879 | |||
| 1880 | if (target_util.llvmMachineAbi(target)) |mabi| { | ||
| 1881 | try argv.append(try allocPrint(arena, "-MLLVM:-target-abi={s}", .{mabi})); | ||
| 1882 | } | ||
| 1883 | |||
| 1884 | try argv.append(try allocPrint(arena, "-MLLVM:-float-abi={s}", .{if (target.abi.floatAbi() == .hard) "hard" else "soft"})); | ||
| 1885 | |||
| 1879 | if (comp.config.lto != .none) { | 1886 | if (comp.config.lto != .none) { |
| 1880 | switch (optimize_mode) { | 1887 | switch (optimize_mode) { |
| 1881 | .Debug => {}, | 1888 | .Debug => {}, |
src/link/Elf.zig+12| ... | @@ -1700,6 +1700,18 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s | ... | @@ -1700,6 +1700,18 @@ fn linkWithLLD(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: s |
| 1700 | try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot})); | 1700 | try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot})); |
| 1701 | } | 1701 | } |
| 1702 | 1702 | ||
| 1703 | if (target_util.llvmMachineAbi(target)) |mabi| { | ||
| 1704 | try argv.appendSlice(&.{ | ||
| 1705 | "-mllvm", | ||
| 1706 | try std.fmt.allocPrint(arena, "-target-abi={s}", .{mabi}), | ||
| 1707 | }); | ||
| 1708 | } | ||
| 1709 | |||
| 1710 | try argv.appendSlice(&.{ | ||
| 1711 | "-mllvm", | ||
| 1712 | try std.fmt.allocPrint(arena, "-float-abi={s}", .{if (target.abi.floatAbi() == .hard) "hard" else "soft"}), | ||
| 1713 | }); | ||
| 1714 | |||
| 1703 | if (comp.config.lto != .none) { | 1715 | if (comp.config.lto != .none) { |
| 1704 | switch (comp.root_mod.optimize_mode) { | 1716 | switch (comp.root_mod.optimize_mode) { |
| 1705 | .Debug => {}, | 1717 | .Debug => {}, |