diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-22 19:26:18 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-22 19:26:18 +0000 |
commit | 7afe0000f60335bc50d19802bdb19b1196de720e (patch) | |
tree | e23da17abce833acac38b192a11db8cad2666156 /lib/MC/MCAsmStreamer.cpp | |
parent | 0d277ab1bad4af37ffeb8110d6bbc84f4f0a905b (diff) | |
download | llvm-7afe0000f60335bc50d19802bdb19b1196de720e.tar.gz llvm-7afe0000f60335bc50d19802bdb19b1196de720e.tar.bz2 llvm-7afe0000f60335bc50d19802bdb19b1196de720e.tar.xz |
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
Diffstat (limited to 'lib/MC/MCAsmStreamer.cpp')
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 759058efcb..85d4dd79b3 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -57,6 +57,8 @@ private: EHPrivateExtern = 1 << 2 }; DenseMap<const MCSymbol*, unsigned> FlagMap; + DenseMap<const MCSymbol*, MCSymbolData*> SymbolMap; + bool needsSet(const MCExpr *Value); void EmitRegisterName(int64_t Register); @@ -252,6 +254,8 @@ public: void EmitRawTextImpl(StringRef String) override; void FinishImpl() override; + + virtual MCSymbolData &getOrCreateSymbolData(const MCSymbol *Symbol) override; }; } // end anonymous namespace. @@ -1417,6 +1421,15 @@ void MCAsmStreamer::FinishImpl() { EmitFrames(AsmBackend.get(), false); } +MCSymbolData &MCAsmStreamer::getOrCreateSymbolData(const MCSymbol *Symbol) { + MCSymbolData *&Entry = SymbolMap[Symbol]; + + if (!Entry) + Entry = new MCSymbolData(*Symbol, 0, 0, 0); + + return *Entry; +} + MCStreamer *llvm::createAsmStreamer(MCContext &Context, formatted_raw_ostream &OS, bool isVerboseAsm, bool useCFI, |