[clang] [clang][WebAssembly] Support the `-m(no-)red-zone` flag. (PR #119997)
Alex Rønne Petersen via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 14 21:19:01 PST 2024
https://github.com/alexrp created https://github.com/llvm/llvm-project/pull/119997
LLVM's WebAssembly backend supports the `noredzone` function attribute, but this support was not exposed in Clang.
Note: I don't have commit access.
>From 28834f7a42511905d8c1e00cb16ea7cdc70bf0c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= <alex at alexrp.com>
Date: Sun, 15 Dec 2024 06:15:24 +0100
Subject: [PATCH] [clang][WebAssembly] Support the -m(no-)red-zone flag.
LLVM's WebAssembly backend supports the noredzone function attribute, but this
support was not exposed in Clang.
---
clang/lib/Driver/ToolChains/Clang.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 7ef55a33547c50..21117cd71b651e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2404,6 +2404,9 @@ void Clang::AddWebAssemblyTargetArgs(const ArgList &Args,
if (!Args.hasArg(options::OPT_fvisibility_EQ,
options::OPT_fvisibility_ms_compat))
CmdArgs.push_back("-fvisibility=hidden");
+
+ if (!Args.hasFlag(options::OPT_mred_zone, options::OPT_mno_red_zone, true))
+ CmdArgs.push_back("-disable-red-zone");
}
void Clang::AddVETargetArgs(const ArgList &Args, ArgStringList &CmdArgs) const {
More information about the cfe-commits
mailing list