diff options
author | Kevin Enderby <enderby@apple.com> | 2009-07-13 21:03:15 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2009-07-13 21:03:15 +0000 |
commit | a5c783280f83df5c60a8ed9e32c61b05a11048e3 (patch) | |
tree | 4bde7c9a4caa986196c8130d8dbfe422e605adc9 | |
parent | eb7f7a86651140fe8c2e00765bcb1cebe675eb33 (diff) | |
download | external_llvm-a5c783280f83df5c60a8ed9e32c61b05a11048e3.zip external_llvm-a5c783280f83df5c60a8ed9e32c61b05a11048e3.tar.gz external_llvm-a5c783280f83df5c60a8ed9e32c61b05a11048e3.tar.bz2 |
add llvm-mc support for parsing the .subsections_via_symbols directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75500 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 5 | ||||
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 6 | ||||
-rw-r--r-- | test/MC/AsmParser/directive_subsections_via_symbols.s | 6 | ||||
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 16 | ||||
-rw-r--r-- | tools/llvm-mc/AsmParser.h | 3 |
5 files changed, 36 insertions, 0 deletions
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index e0c50eb..dc185ae 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -89,6 +89,11 @@ namespace llvm { // symbol section in the constructor and initialize it here? virtual void EmitLabel(MCSymbol *Symbol) = 0; + /// SubsectionsViaSymbols - Note in the output that the conventions used in + /// in the assembly file allows the bytes of a section to be divided up at + /// the boundaries of the symbols by a link editor for processing as atoms. + virtual void SubsectionsViaSymbols(void) = 0; + /// EmitAssignment - Emit an assignment of @param Value to @param Symbol. /// /// This corresponds to an assembler statement such as: diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 172ae9e..c0a334a 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -38,6 +38,8 @@ namespace { virtual void EmitLabel(MCSymbol *Symbol); + virtual void SubsectionsViaSymbols(void); + virtual void EmitAssignment(MCSymbol *Symbol, const MCValue &Value, bool MakeAbsolute = false); @@ -117,6 +119,10 @@ void MCAsmStreamer::EmitLabel(MCSymbol *Symbol) { Symbol->setExternal(false); } +void MCAsmStreamer::SubsectionsViaSymbols(void) { + OS << ".subsections_via_symbols\n"; +} + void MCAsmStreamer::EmitAssignment(MCSymbol *Symbol, const MCValue &Value, bool MakeAbsolute) { assert(!Symbol->getSection() && "Cannot assign to a label!"); diff --git a/test/MC/AsmParser/directive_subsections_via_symbols.s b/test/MC/AsmParser/directive_subsections_via_symbols.s new file mode 100644 index 0000000..826b7f1 --- /dev/null +++ b/test/MC/AsmParser/directive_subsections_via_symbols.s @@ -0,0 +1,6 @@ +# RUN: llvm-mc %s | FileCheck %s + +# CHECK: TEST0: +# CHECK: .subsections_via_symbols +TEST0: + .subsections_via_symbols diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index a2cdea4..fe9d4f3 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -527,6 +527,9 @@ bool AsmParser::ParseStatement() { if (!strcmp(IDVal, ".zerofill")) return ParseDirectiveDarwinZerofill(); + if (!strcmp(IDVal, ".subsections_via_symbols")) + return ParseDirectiveDarwinSubsectionsViaSymbols(); + Warning(IDLoc, "ignoring directive for now"); EatToEndOfStatement(); return false; @@ -1052,3 +1055,16 @@ bool AsmParser::ParseDirectiveDarwinZerofill() { return false; } + +/// ParseDirectiveDarwinSubsectionsViaSymbols +/// ::= .subsections_via_symbols +bool AsmParser::ParseDirectiveDarwinSubsectionsViaSymbols() { + if (Lexer.isNot(asmtok::EndOfStatement)) + return TokError("unexpected token in '.subsections_via_symbols' directive"); + + Lexer.Lex(); + + Out.SubsectionsViaSymbols(); + + return false; +} diff --git a/tools/llvm-mc/AsmParser.h b/tools/llvm-mc/AsmParser.h index 620ac19..fcdd064 100644 --- a/tools/llvm-mc/AsmParser.h +++ b/tools/llvm-mc/AsmParser.h @@ -112,6 +112,9 @@ private: bool ParseDirectiveComm(bool IsLocal); // ".comm" and ".lcomm" bool ParseDirectiveDarwinZerofill(); // Darwin specific ".zerofill" + + // Darwin specific ".subsections_via_symbols" + bool ParseDirectiveDarwinSubsectionsViaSymbols(); }; } // end namespace llvm |