-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SPARC][Driver] Set correct IAS mode defaults for Linux and Free/OpenBSD #130108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
On those OSes, clang should set the assembler to enable VIS by default. This is already the case when clang calls an external assembler, so make sure clang+IAS use the same defaults. This should fix [issue llvm#125124](llvm#125124).
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-driver Author: Koakuma (koachan) ChangesOn those OSes, clang should set the assembler to enable VIS by default. This is already the case when clang calls an external assembler, so make sure clang+IAS use the same defaults. This should fix issue #125124. Full diff: https://github.com/llvm/llvm-project/pull/130108.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 4ebbd241d2f0b..e70833cc4a38e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2876,6 +2876,17 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
CmdArgs.push_back("-target-feature");
CmdArgs.push_back(MipsTargetFeature);
}
+
+ // Those OSes default to enabling VIS on 64-bit SPARC.
+ // See also the corresponding code for external assemblers in
+ // sparc::getSparcAsmModeForCPU().
+ bool IsSparcV9ATarget =
+ (C.getDefaultToolChain().getArch() == llvm::Triple::sparcv9) &&
+ (Triple.isOSLinux() || Triple.isOSFreeBSD() || Triple.isOSOpenBSD());
+ if (IsSparcV9ATarget && SparcTargetFeatures.empty()) {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+vis");
+ }
for (const char *Feature : SparcTargetFeatures) {
CmdArgs.push_back("-target-feature");
CmdArgs.push_back(Feature);
diff --git a/clang/test/Driver/sparc-ias-Wa.s b/clang/test/Driver/sparc-ias-Wa.s
index 79456c02935be..c031f237297d3 100644
--- a/clang/test/Driver/sparc-ias-Wa.s
+++ b/clang/test/Driver/sparc-ias-Wa.s
@@ -58,3 +58,12 @@
// V9D: "-target-feature" "+vis"
// V9D: "-target-feature" "+vis2"
// V9D: "-target-feature" "+vis3"
+
+// RUN: %clang --target=sparc64-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=VIS-DEFAULT %s
+// RUN: %clang --target=sparc64-freebsd -### -fintegrated-as -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=VIS-DEFAULT %s
+// RUN: %clang --target=sparc64-openbsd -### -fintegrated-as -c %s 2>&1 | \
+// RUN: FileCheck -check-prefix=VIS-DEFAULT %s
+// VIS-DEFAULT: -cc1as
+// VIS-DEFAULT: "-target-feature" "+vis"
|
Pinging @bsdkurt for this too. |
I back ported this to llvm 19 and confirm it works to set VIS by default on OpenBSD. Thanks for the fix. |
SPARC architecture and for setting the default to vis/-Av9a. Needed for building base and xenocara on sparc64. llvm/llvm-project#125151 llvm/llvm-project#130108
Ping? |
On those OSes, clang should set the assembler to enable VIS by default. This is already the case when clang calls an external assembler, so make sure clang+IAS use the same defaults.
This should fix issue #125124.