aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-10-03 03:22:02 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-10-03 03:29:20 +0200
commit91fa2c61aacd002228c37cb651fa0a350bd7ac59 (patch)
tree75efed76fbc47b7383e2fb50137bab00f962707f /src/Compilation.zig
parentbc4da9a90743c11c7c0b3e485f46d365d57d87b7 (diff)
downloadzig-91fa2c61aacd002228c37cb651fa0a350bd7ac59.tar.gz
zig-91fa2c61aacd002228c37cb651fa0a350bd7ac59.zip
compiler: control the s390x backchain feature through the frame pointer option
This is a little different from how C/C++ compilers do this, but I think it's justified because it's what users actually *mean* when the use frame pointer options. This is another one of those LLVM "CPU" features that have nothing to do with CPU at all and should really be a TargetMachine option or something. One day we'll figure out a better way of dealing with these...
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 86b1356a3f..f13a232e47 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -7193,6 +7193,9 @@ pub fn addCCArgs(
}
try argv.append(if (mod.omit_frame_pointer) "-fomit-frame-pointer" else "-fno-omit-frame-pointer");
+ if (target.cpu.arch == .s390x) {
+ try argv.append(if (mod.omit_frame_pointer) "-mbackchain" else "-mno-backchain");
+ }
const ssp_buf_size = mod.stack_protector;
if (ssp_buf_size != 0) {
@@ -7258,9 +7261,10 @@ pub fn addCCArgs(
const is_enabled = target.cpu.features.isEnabled(index);
if (feature.llvm_name) |llvm_name| {
- // We communicate float ABI to Clang through the dedicated options.
+ // We communicate these to Clang through the dedicated options.
if (std.mem.startsWith(u8, llvm_name, "soft-float") or
- std.mem.startsWith(u8, llvm_name, "hard-float"))
+ std.mem.startsWith(u8, llvm_name, "hard-float") or
+ (target.cpu.arch == .s390x and std.mem.eql(u8, llvm_name, "backchain")))
continue;
// Ignore these until we figure out how to handle the concept of omitting features.