mstorsjo created this revision.
mstorsjo added a subscriber: cfe-commits.
Herald added subscribers: samparker, rengolin, aemerson.

This makes sure that the thumb section flag gets set by the assembler.

This is an alternative fix to D22776.

https://reviews.llvm.org/D22855

Files:
  lib/Driver/ToolChain.cpp
  test/Driver/thumb-attributes.s

Index: test/Driver/thumb-attributes.s
===================================================================
--- /dev/null
+++ test/Driver/thumb-attributes.s
@@ -0,0 +1,22 @@
+@ RUN: %clang -target armv7-windows-itanium -c -o - %s \
+@ RUN:   | llvm-readobj -s - | FileCheck %s
+
+       .syntax unified
+       .thumb
+
+       .text
+
+       .global function
+       .thumb_func
+function:
+       bx lr
+
+@ CHECK: Sections [
+@ CHECK:   Section {
+@ CHECK:     Name: .text
+@ CHECK:     Characteristics [
+@ CHECK-DAG:   IMAGE_SCN_CNT_CODE
+@ CHECK-DAG:   IMAGE_SCN_MEM_16BIT
+@ CHECK:     ]
+@ CHECK:   }
+@ CHECK: ]
Index: lib/Driver/ToolChain.cpp
===================================================================
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -493,8 +493,10 @@
       ArchName = "arm";
 
     // Assembly files should start in ARM mode, unless arch is M-profile.
+    // Windows is always thumb.
     if ((InputType != types::TY_PP_Asm && Args.hasFlag(options::OPT_mthumb,
-         options::OPT_mno_thumb, ThumbDefault)) || IsMProfile) {
+         options::OPT_mno_thumb, ThumbDefault)) || IsMProfile ||
+         getTriple().isOSWindows()) {
       if (IsBigEndian)
         ArchName = "thumbeb";
       else


Index: test/Driver/thumb-attributes.s
===================================================================
--- /dev/null
+++ test/Driver/thumb-attributes.s
@@ -0,0 +1,22 @@
+@ RUN: %clang -target armv7-windows-itanium -c -o - %s \
+@ RUN:   | llvm-readobj -s - | FileCheck %s
+
+	.syntax unified
+	.thumb
+
+	.text
+
+	.global function
+	.thumb_func
+function:
+	bx lr
+
+@ CHECK: Sections [
+@ CHECK:   Section {
+@ CHECK:     Name: .text
+@ CHECK:     Characteristics [
+@ CHECK-DAG:   IMAGE_SCN_CNT_CODE
+@ CHECK-DAG:   IMAGE_SCN_MEM_16BIT
+@ CHECK:     ]
+@ CHECK:   }
+@ CHECK: ]
Index: lib/Driver/ToolChain.cpp
===================================================================
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -493,8 +493,10 @@
       ArchName = "arm";
 
     // Assembly files should start in ARM mode, unless arch is M-profile.
+    // Windows is always thumb.
     if ((InputType != types::TY_PP_Asm && Args.hasFlag(options::OPT_mthumb,
-         options::OPT_mno_thumb, ThumbDefault)) || IsMProfile) {
+         options::OPT_mno_thumb, ThumbDefault)) || IsMProfile ||
+         getTriple().isOSWindows()) {
       if (IsBigEndian)
         ArchName = "thumbeb";
       else
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to