r202462 - Add support for OpenBSD SPARC assembler.
Rafael Espindola
rafael.espindola at gmail.com
Thu Feb 27 17:55:21 PST 2014
Author: rafael
Date: Thu Feb 27 19:55:21 2014
New Revision: 202462
URL: http://llvm.org/viewvc/llvm-project?rev=202462&view=rev
Log:
Add support for OpenBSD SPARC assembler.
Patch by Brad Smith.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/openbsd.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=202462&r1=202461&r2=202462&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Feb 27 19:55:21 2014
@@ -5600,16 +5600,33 @@ void openbsd::Assemble::ConstructJob(Com
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
+ bool NeedsKPIC = false;
- // When building 32-bit code on OpenBSD/amd64, we have to explicitly
- // instruct as in the base system to assemble 32-bit code.
- if (getToolChain().getArch() == llvm::Triple::x86)
+ switch (getToolChain().getArch()) {
+ case llvm::Triple::x86:
+ // When building 32-bit code on OpenBSD/amd64, we have to explicitly
+ // instruct as in the base system to assemble 32-bit code.
CmdArgs.push_back("--32");
- else if (getToolChain().getArch() == llvm::Triple::ppc) {
+ break;
+
+ case llvm::Triple::ppc:
CmdArgs.push_back("-mppc");
CmdArgs.push_back("-many");
- } else if (getToolChain().getArch() == llvm::Triple::mips64 ||
- getToolChain().getArch() == llvm::Triple::mips64el) {
+ break;
+
+ case llvm::Triple::sparc:
+ CmdArgs.push_back("-32");
+ NeedsKPIC = true;
+ break;
+
+ case llvm::Triple::sparcv9:
+ CmdArgs.push_back("-64");
+ CmdArgs.push_back("-Av9a");
+ NeedsKPIC = true;
+ break;
+
+ case llvm::Triple::mips64:
+ case llvm::Triple::mips64el: {
StringRef CPUName;
StringRef ABIName;
getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
@@ -5622,9 +5639,17 @@ void openbsd::Assemble::ConstructJob(Com
else
CmdArgs.push_back("-EL");
- addAssemblerKPIC(Args, CmdArgs);
+ NeedsKPIC = true;
+ break;
}
+ default:
+ break;
+ }
+
+ if (NeedsKPIC)
+ addAssemblerKPIC(Args, CmdArgs);
+
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
options::OPT_Xassembler);
Modified: cfe/trunk/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=202462&r1=202461&r2=202462&view=diff
==============================================================================
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Thu Feb 27 19:55:21 2014
@@ -39,6 +39,10 @@
// RUN: | FileCheck -check-prefix=CHECK-AMD64-M32 %s
// RUN: %clang -target powerpc-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-POWERPC %s
+// RUN: %clang -target sparc-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-SPARC %s
+// RUN: %clang -target sparc64-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-SPARC64 %s
// RUN: %clang -target mips64-unknown-openbsd -### -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-MIPS64 %s
// RUN: %clang -target mips64-unknown-openbsd -fPIC -### -no-integrated-as -c %s 2>&1 \
@@ -49,6 +53,8 @@
// RUN: | FileCheck -check-prefix=CHECK-MIPS64EL-PIC %s
// CHECK-AMD64-M32: as{{.*}}" "--32"
// CHECK-POWERPC: as{{.*}}" "-mppc" "-many"
+// CHECK-SPARC: as{{.*}}" "-32"
+// CHECK-SPARC64: as{{.*}}" "-64" "-Av9a"
// CHECK-MIPS64: as{{.*}}" "-mabi" "64" "-EB"
// CHECK-MIPS64-PIC: as{{.*}}" "-mabi" "64" "-EB" "-KPIC"
// CHECK-MIPS64EL: as{{.*}}" "-mabi" "64" "-EL"
More information about the cfe-commits
mailing list