[PATCH] D22776: [ARM] Set the thumb flag for all text segments on COFF (partial revert of recent commit)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 27 04:06:01 PDT 2016
mstorsjo updated this revision to Diff 65700.
mstorsjo added a comment.
Added a test for this issue. Whichever way it is solved, this test should pass.
https://reviews.llvm.org/D22776
Files:
lib/MC/MCObjectFileInfo.cpp
test/MC/ARM/Windows/thumb-attributes.s
Index: test/MC/ARM/Windows/thumb-attributes.s
===================================================================
--- /dev/null
+++ test/MC/ARM/Windows/thumb-attributes.s
@@ -0,0 +1,25 @@
+@ RUN: llvm-mc -triple armv7-windows-itanium -filetype obj -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: IMAGE_SCN_ALIGN_4BYTES
+@ CHECK: IMAGE_SCN_CNT_CODE
+@ CHECK: IMAGE_SCN_MEM_16BIT
+@ CHECK: IMAGE_SCN_MEM_EXECUTE
+@ CHECK: IMAGE_SCN_MEM_READ
+@ CHECK: ]
+@ CHECK: }
+@ CHECK: ]
Index: lib/MC/MCObjectFileInfo.cpp
===================================================================
--- lib/MC/MCObjectFileInfo.cpp
+++ lib/MC/MCObjectFileInfo.cpp
@@ -598,7 +598,10 @@
// Set the `IMAGE_SCN_MEM_16BIT` flag when compiling for thumb mode. This is
// used to indicate to the linker that the text segment contains thumb instructions
// and to set the ISA selection bit for calls accordingly.
- const bool IsThumb = T.getArch() == Triple::thumb;
+ // In practice, COFF currently is only supported on Windows, and Windows
+ // on ARM is thumb only. When invoked via the clang driver, the triple
+ // is set to arm-* since the assembler always should start in ARM mode.
+ const bool IsThumb = T.getArch() == Triple::arm || T.getArch() == Triple::thumb;
CommDirectiveSupportsAlignment = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22776.65700.patch
Type: text/x-patch
Size: 1551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160727/c66cddd0/attachment.bin>
More information about the llvm-commits
mailing list