Hello,

When clang is invoked with -march=armv4 and no -mcpu is
specified, the arm7tdmi cpu was selected as reference.
That causes clang to emit bx lr instructions since its
architecture is armv4t. When gas is used for assembling the
-march=armv4 is passed on and hence fails with:

    "selected processor does not support ARM mode `bx lr'"

Attached patch makes the strongarm the reference cpu for
armv4 to resolve the problem. Also the default is updated,
since the armv4 is more basic then armv4t.

Regards,
Jeroen

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp	(revision 183626)
+++ lib/Driver/Tools.cpp	(working copy)
@@ -446,6 +446,7 @@
 // FIXME: tblgen this, or kill it!
 static const char *getLLVMArchSuffixForARM(StringRef CPU) {
   return llvm::StringSwitch<const char *>(CPU)
+    .Case("strongarm", "v4")
     .Cases("arm7tdmi", "arm7tdmi-s", "arm710t", "v4t")
     .Cases("arm720t", "arm9", "arm9tdmi", "v4t")
     .Cases("arm920", "arm920t", "arm922t", "v4t")
@@ -510,7 +511,8 @@
     .Cases("armv2", "armv2a","arm2")
     .Case("armv3", "arm6")
     .Case("armv3m", "arm7m")
-    .Cases("armv4", "armv4t", "arm7tdmi")
+    .Case("armv4", "strongarm")
+    .Case("armv4t", "arm7tdmi")
     .Cases("armv5", "armv5t", "arm10tdmi")
     .Cases("armv5e", "armv5te", "arm1022e")
     .Case("armv5tej", "arm926ej-s")
@@ -529,7 +531,7 @@
     .Case("iwmmxt", "iwmmxt")
     .Case("xscale", "xscale")
     // If all else failed, return the most base CPU LLVM supports.
-    .Default("arm7tdmi");
+    .Default("strongarm");
 }
 
 // FIXME: Move to target hook.
Index: lib/Driver/ToolChain.cpp
===================================================================
--- lib/Driver/ToolChain.cpp	(revision 183626)
+++ lib/Driver/ToolChain.cpp	(working copy)
@@ -177,7 +177,8 @@
     .Cases("armv2", "armv2a","arm2")
     .Case("armv3", "arm6")
     .Case("armv3m", "arm7m")
-    .Cases("armv4", "armv4t", "arm7tdmi")
+    .Case("armv4", "strongarm")
+    .Case("armv4t", "arm7tdmi")
     .Cases("armv5", "armv5t", "arm10tdmi")
     .Cases("armv5e", "armv5te", "arm1026ejs")
     .Case("armv5tej", "arm926ej-s")
@@ -197,7 +198,7 @@
     .Case("iwmmxt", "iwmmxt")
     .Case("xscale", "xscale")
     // If all else failed, return the most base CPU LLVM supports.
-    .Default("arm7tdmi");
+    .Default("strongarm");
 }
 
 /// getLLVMArchSuffixForARM - Get the LLVM arch name to use for a particular
@@ -207,6 +208,7 @@
 // FIXME: tblgen this, or kill it!
 static const char *getLLVMArchSuffixForARM(StringRef CPU) {
   return llvm::StringSwitch<const char *>(CPU)
+    .Case("strongarm", "v4")
     .Cases("arm7tdmi", "arm7tdmi-s", "arm710t", "v4t")
     .Cases("arm720t", "arm9", "arm9tdmi", "v4t")
     .Cases("arm920", "arm920t", "arm922t", "v4t")
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to