[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
Mon Jul 25 13:40:19 PDT 2016


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

This is a partial revert of changes in SVN rev 273880 (changes that are unrelated to what is described in the commit message).

That commit also changed MCObjectFileInfo to only set the thumb flag if the triple architecture is thumb, no longer setting it if the architecture is arm. This is probably correct per se, but negatively affects standalone assembly files assembled via clang for windows.

When assembling files via clang, even if the target triple set on the command line is e.g. thumb-win32, the driver sets the triple to armv7--windows-msvc18.0.0 (or similar; see tools/clang/lib/Driver/ToolChain.cpp) since assembly files should start in ARM mode by default.

This means that it currently is impossible to get the thumb code flag set for these sections, when assembling via clang.


https://reviews.llvm.org/D22776

Files:
  lib/MC/MCObjectFileInfo.cpp

Index: lib/MC/MCObjectFileInfo.cpp
===================================================================
--- lib/MC/MCObjectFileInfo.cpp
+++ lib/MC/MCObjectFileInfo.cpp
@@ -598,7 +598,7 @@
   // 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;
+  const bool IsThumb = T.getArch() == Triple::arm || T.getArch() == Triple::thumb;
 
   CommDirectiveSupportsAlignment = true;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22776.65411.patch
Type: text/x-patch
Size: 601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160725/34466f12/attachment.bin>


More information about the llvm-commits mailing list