ARM IAS: properly handle function entries in .thumb
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sat, 22 Mar 2014 19:26:18 +0000 (19:26 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sat, 22 Mar 2014 19:26:18 +0000 (19:26 +0000)
commit7afe0000f60335bc50d19802bdb19b1196de720e
treee23da17abce833acac38b192a11db8cad2666156
parent0d277ab1bad4af37ffeb8110d6bbc84f4f0a905b
ARM IAS: properly handle function entries in .thumb

When a label is parsed, check if there is type information available for the
label.  If so, check if the symbol is a function.  If the symbol is a function
and we are in thumb mode and no explicit thumb_func has been emitted, adjust the
symbol data to indicate that the function definition is a thumb function.

The application of this inferencing is improved value handling in the object
file (the required thumb bit is set on symbols which are thumb functions).  It
also helps improve compatibility with binutils.

The one complication that arises from this handling is the MCAsmStreamer.  The
default implementation of getOrCreateSymbolData in MCStreamer does not support
tracking the symbol data.  In order to support the semantics of thumb functions,
track symbol data in assembly streamer.  Although O(n) in number of labels in
the TU, this is already done in various other streamers and as such the memory
overhead is not a practical concern in this scenario.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204544 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/MCAsmStreamer.cpp
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/thumb-types.s [new file with mode: 0644]
test/MC/ARM/thumb_set.s