diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-06-18 00:19:35 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-06-18 00:19:35 +0000 |
commit | 098321c1454fff7f86200d252f60ad9f8720d658 (patch) | |
tree | 89cf2a7e6c0c8652bbc79f72353eb045251596db /llvm/lib/MC | |
parent | e4a1266a9a67c31c233e19a6ccea07c3baa3e068 (diff) | |
download | bcm5719-llvm-098321c1454fff7f86200d252f60ad9f8720d658.tar.gz bcm5719-llvm-098321c1454fff7f86200d252f60ad9f8720d658.zip |
* Override the "EmitBytes" function, since it can sneak values in that way.
* Make this used only if CFI is used.
llvm-svn: 133319
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCAsmStreamer.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 636da33f9df..a1dcf2ed4a6 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -1342,6 +1342,7 @@ public: Assignments.push_back(Value); MCAsmStreamer::EmitAssignment(Symbol, Value); } + virtual void EmitBytes(StringRef Data, unsigned AddrSpace); virtual void EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace = 0); virtual void EmitValueImpl(const MCExpr *Value, unsigned Size, @@ -1360,6 +1361,22 @@ public: } // end anonymous namespace +void MCLSDADecoderAsmStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) { + if (InLSDA && Data.size() == 1) { + LSDAEncoding.push_back((unsigned)(unsigned char)Data[0]); + ++BytesRead; + + if (LSDAEncoding.size() == 4) + // The fourth value tells us where the bottom of the type table is. + LSDASize = BytesRead + LSDAEncoding[3]; + else if (LSDAEncoding.size() == 6) + // The sixth value tells us where the start of the action table is. + ActionTableBytes = BytesRead; + } + + MCAsmStreamer::EmitBytes(Data, AddrSpace); +} + void MCLSDADecoderAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace) { if (!InLSDA) @@ -1607,7 +1624,7 @@ MCStreamer *llvm::createAsmStreamer(MCContext &Context, ExceptionHandling::ExceptionsType ET = Context.getAsmInfo().getExceptionHandlingType(); - if (isVerboseAsm && + if (useCFI && isVerboseAsm && (ET == ExceptionHandling::SjLj || ET == ExceptionHandling::DwarfCFI)) return new MCLSDADecoderAsmStreamer(Context, OS, isVerboseAsm, useLoc, useCFI, IP, CE, TAB, ShowInst); |