1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

add llvm-mc support for parsing the .subsections_via_symbols directive.

llvm-svn: 75500
This commit is contained in:
Kevin Enderby 2009-07-13 21:03:15 +00:00
parent baf7e04afa
commit a461788d6a
5 changed files with 36 additions and 0 deletions

View File

@ -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:

View File

@ -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!");

View File

@ -0,0 +1,6 @@
# RUN: llvm-mc %s | FileCheck %s
# CHECK: TEST0:
# CHECK: .subsections_via_symbols
TEST0:
.subsections_via_symbols

View File

@ -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;
}

View File

@ -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