MC: adjust text section flags for WoA
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 22 Jun 2014 22:25:01 +0000 (22:25 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 22 Jun 2014 22:25:01 +0000 (22:25 +0000)
commitbdbc0088da6413a2f970cc0d49a723aedd3f35c6
tree6a72d42cb0c71d3f0178350bb653e3ac2e29274e
parentd77cefe633bd1a107232def8b9655978b8f6fe41
MC: adjust text section flags for WoA

Correct the section flags for code built for Windows on ARM with
`-ffunction-sections`.  Windows on ARM uses solely Thumb-2 instructions, and
indicates that the function is thumb by placing it in a text section that has
IMAGE_SCN_MEM_16BIT flag set.

When we encounter a .section directive, a new section is constructed.  This may
be a text segment.  In order to identify that we need the additional flag,
expose the target triple through the ObjectFileInfo as this information is lost
otherwise.

Since any modern ARM targeting environment on Windows would be Thumb-2 (Windows
ARM NT or Windows Embedded Compact), introducing a new flag to indicate the
section attribute seems to be a bit overkill.  Simply depend on the target
triple.  Since there is one location that this information is currently needed,
creating a target specific assembly parser and delegating the parsing of section
switches also feels a bit heavy handed.  If it turns out that this information
ends up changing additional behaviour, then it may be worth considering that
alternative.

llvm-svn: 211481
llvm/include/llvm/MC/MCObjectFileInfo.h
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/lib/MC/MCParser/COFFAsmParser.cpp
llvm/test/MC/ARM/Windows/multiple-text-sections.s [new file with mode: 0644]