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)
commit7a3698ecc95d16af547fce9acfd15ed81dd0ad55
tree2a8e0232cf8758ac97239b204cf61259ed52ca1a
parent9124b45918e0b59c37604ea4bb033aaa691a168d
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211481 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCObjectFileInfo.h
lib/MC/MCObjectFileInfo.cpp
lib/MC/MCParser/COFFAsmParser.cpp
test/MC/ARM/Windows/multiple-text-sections.s [new file with mode: 0644]