return *tok;
}
-bool AsmParser::Run() {
- // Create the initial section.
+bool AsmParser::Run(bool NoInitialTextSection) {
+ // Create the initial section, if requested.
//
- // FIXME: Support -n.
// FIXME: Target hook & command line option for initial section.
- Out.SwitchSection(getMachOSection("__TEXT", "__text",
- MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
- 0, SectionKind::getText()));
-
+ if (!NoInitialTextSection)
+ Out.SwitchSection(getMachOSection("__TEXT", "__text",
+ MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+ 0, SectionKind::getText()));
// Prime the lexer.
Lex();
TripleName("triple", cl::desc("Target triple to assemble for, "
"see -version for available targets"));
+static cl::opt<bool>
+NoInitialTextSection("n", cl::desc(
+ "Don't assume assembly file starts in the text section"));
+
enum ActionType {
AC_AsLex,
AC_Assemble,
Parser.setTargetParser(*TAP.get());
- int Res = Parser.Run();
+ int Res = Parser.Run(NoInitialTextSection);
if (Out != &fouts())
delete Out;