/src/keystone/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===- DarwinAsmParser.cpp - Darwin (Mach-O) Assembly Parser --------------===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | |
10 | | #include "llvm/MC/MCParser/MCAsmParserExtension.h" |
11 | | #include "llvm/ADT/STLExtras.h" |
12 | | #include "llvm/ADT/StringRef.h" |
13 | | #include "llvm/ADT/StringSwitch.h" |
14 | | #include "llvm/ADT/Triple.h" |
15 | | #include "llvm/ADT/Twine.h" |
16 | | #include "llvm/MC/MCContext.h" |
17 | | #include "llvm/MC/MCObjectFileInfo.h" |
18 | | #include "llvm/MC/MCParser/MCAsmLexer.h" |
19 | | #include "llvm/MC/MCParser/MCAsmParser.h" |
20 | | #include "llvm/MC/MCSectionMachO.h" |
21 | | #include "llvm/MC/MCStreamer.h" |
22 | | #include "llvm/MC/MCSymbol.h" |
23 | | #include "llvm/Support/FileSystem.h" |
24 | | #include "llvm/Support/MemoryBuffer.h" |
25 | | #include "llvm/Support/SourceMgr.h" |
26 | | using namespace llvm_ks; |
27 | | |
28 | | namespace { |
29 | | |
30 | | /// \brief Implementation of directive handling which is shared across all |
31 | | /// Darwin targets. |
32 | | class DarwinAsmParser : public MCAsmParserExtension { |
33 | | template<bool (DarwinAsmParser::*HandlerMethod)(StringRef, SMLoc)> |
34 | 8.77M | void addDirectiveHandler(StringRef Directive) { |
35 | 8.77M | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( |
36 | 8.77M | this, HandleDirective<DarwinAsmParser, HandlerMethod>); |
37 | 8.77M | getParser().addDirectiveHandler(Directive, Handler); |
38 | 8.77M | } DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveDesc>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveIndirectSymbol>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveLsym>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveSubsectionsViaSymbols>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveDumpOrLoad>(llvm_ks::StringRef) Line | Count | Source | 34 | 265k | void addDirectiveHandler(StringRef Directive) { | 35 | 265k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 265k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 265k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 265k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveSection>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectivePushSection>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectivePopSection>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectivePrevious>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveSecureLogUnique>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveSecureLogReset>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveTBSS>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveZerofill>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveDataRegion>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveDataRegionEnd>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveBss>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveConst>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveConstData>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveConstructor>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveCString>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveData>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveDestructor>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveDyld>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveFVMLibInit0>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveFVMLibInit1>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLazySymbolPointers>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseDirectiveLinkerOption>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLiteral16>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLiteral4>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveLiteral8>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveModInitFunc>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveModTermFunc>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveNonLazySymbolPointers>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCCatClsMeth>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCCatInstMeth>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCCategory>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClass>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClassNames>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClassVars>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClsMeth>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCClsRefs>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCInstMeth>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCInstanceVars>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMessageRefs>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMetaClass>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMethVarNames>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCMethVarTypes>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCModuleInfo>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCProtocol>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCSelectorStrs>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCStringObject>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveObjCSymbols>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectivePICSymbolStub>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveStaticConst>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveStaticData>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveSymbolStub>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveTData>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveText>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveThreadInitFunc>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveTLV>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseSectionDirectiveIdent>(llvm_ks::StringRef) Line | Count | Source | 34 | 132k | void addDirectiveHandler(StringRef Directive) { | 35 | 132k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 132k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 132k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 132k | } |
DarwinAsmParser.cpp:void (anonymous namespace)::DarwinAsmParser::addDirectiveHandler<&(anonymous namespace)::DarwinAsmParser::parseVersionMin>(llvm_ks::StringRef) Line | Count | Source | 34 | 531k | void addDirectiveHandler(StringRef Directive) { | 35 | 531k | MCAsmParser::ExtensionDirectiveHandler Handler = std::make_pair( | 36 | 531k | this, HandleDirective<DarwinAsmParser, HandlerMethod>); | 37 | 531k | getParser().addDirectiveHandler(Directive, Handler); | 38 | 531k | } |
|
39 | | |
40 | | bool parseSectionSwitch(const char *Segment, const char *Section, |
41 | | unsigned TAA = 0, unsigned ImplicitAlign = 0, |
42 | | unsigned StubSize = 0); |
43 | | |
44 | | SMLoc LastVersionMinDirective; |
45 | | |
46 | | public: |
47 | 132k | DarwinAsmParser() {} |
48 | | |
49 | 132k | void Initialize(MCAsmParser &Parser) override { |
50 | | // Call the base implementation. |
51 | 132k | this->MCAsmParserExtension::Initialize(Parser); |
52 | | |
53 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveDesc>(".desc"); |
54 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveIndirectSymbol>( |
55 | 132k | ".indirect_symbol"); |
56 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveLsym>(".lsym"); |
57 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveSubsectionsViaSymbols>( |
58 | 132k | ".subsections_via_symbols"); |
59 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveDumpOrLoad>(".dump"); |
60 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveDumpOrLoad>(".load"); |
61 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveSection>(".section"); |
62 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectivePushSection>( |
63 | 132k | ".pushsection"); |
64 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectivePopSection>( |
65 | 132k | ".popsection"); |
66 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectivePrevious>(".previous"); |
67 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveSecureLogUnique>( |
68 | 132k | ".secure_log_unique"); |
69 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveSecureLogReset>( |
70 | 132k | ".secure_log_reset"); |
71 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveTBSS>(".tbss"); |
72 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveZerofill>(".zerofill"); |
73 | | |
74 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveDataRegion>( |
75 | 132k | ".data_region"); |
76 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveDataRegionEnd>( |
77 | 132k | ".end_data_region"); |
78 | | |
79 | | // Special section directives. |
80 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveBss>(".bss"); |
81 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveConst>(".const"); |
82 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveConstData>( |
83 | 132k | ".const_data"); |
84 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveConstructor>( |
85 | 132k | ".constructor"); |
86 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveCString>( |
87 | 132k | ".cstring"); |
88 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveData>(".data"); |
89 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveDestructor>( |
90 | 132k | ".destructor"); |
91 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveDyld>(".dyld"); |
92 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveFVMLibInit0>( |
93 | 132k | ".fvmlib_init0"); |
94 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveFVMLibInit1>( |
95 | 132k | ".fvmlib_init1"); |
96 | 132k | addDirectiveHandler< |
97 | 132k | &DarwinAsmParser::parseSectionDirectiveLazySymbolPointers>( |
98 | 132k | ".lazy_symbol_pointer"); |
99 | 132k | addDirectiveHandler<&DarwinAsmParser::parseDirectiveLinkerOption>( |
100 | 132k | ".linker_option"); |
101 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveLiteral16>( |
102 | 132k | ".literal16"); |
103 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveLiteral4>( |
104 | 132k | ".literal4"); |
105 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveLiteral8>( |
106 | 132k | ".literal8"); |
107 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveModInitFunc>( |
108 | 132k | ".mod_init_func"); |
109 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveModTermFunc>( |
110 | 132k | ".mod_term_func"); |
111 | 132k | addDirectiveHandler< |
112 | 132k | &DarwinAsmParser::parseSectionDirectiveNonLazySymbolPointers>( |
113 | 132k | ".non_lazy_symbol_pointer"); |
114 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCCatClsMeth>( |
115 | 132k | ".objc_cat_cls_meth"); |
116 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCCatInstMeth>( |
117 | 132k | ".objc_cat_inst_meth"); |
118 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCCategory>( |
119 | 132k | ".objc_category"); |
120 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClass>( |
121 | 132k | ".objc_class"); |
122 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClassNames>( |
123 | 132k | ".objc_class_names"); |
124 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClassVars>( |
125 | 132k | ".objc_class_vars"); |
126 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClsMeth>( |
127 | 132k | ".objc_cls_meth"); |
128 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCClsRefs>( |
129 | 132k | ".objc_cls_refs"); |
130 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCInstMeth>( |
131 | 132k | ".objc_inst_meth"); |
132 | 132k | addDirectiveHandler< |
133 | 132k | &DarwinAsmParser::parseSectionDirectiveObjCInstanceVars>( |
134 | 132k | ".objc_instance_vars"); |
135 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCMessageRefs>( |
136 | 132k | ".objc_message_refs"); |
137 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCMetaClass>( |
138 | 132k | ".objc_meta_class"); |
139 | 132k | addDirectiveHandler< |
140 | 132k | &DarwinAsmParser::parseSectionDirectiveObjCMethVarNames>( |
141 | 132k | ".objc_meth_var_names"); |
142 | 132k | addDirectiveHandler< |
143 | 132k | &DarwinAsmParser::parseSectionDirectiveObjCMethVarTypes>( |
144 | 132k | ".objc_meth_var_types"); |
145 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCModuleInfo>( |
146 | 132k | ".objc_module_info"); |
147 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCProtocol>( |
148 | 132k | ".objc_protocol"); |
149 | 132k | addDirectiveHandler< |
150 | 132k | &DarwinAsmParser::parseSectionDirectiveObjCSelectorStrs>( |
151 | 132k | ".objc_selector_strs"); |
152 | 132k | addDirectiveHandler< |
153 | 132k | &DarwinAsmParser::parseSectionDirectiveObjCStringObject>( |
154 | 132k | ".objc_string_object"); |
155 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveObjCSymbols>( |
156 | 132k | ".objc_symbols"); |
157 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectivePICSymbolStub>( |
158 | 132k | ".picsymbol_stub"); |
159 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveStaticConst>( |
160 | 132k | ".static_const"); |
161 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveStaticData>( |
162 | 132k | ".static_data"); |
163 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveSymbolStub>( |
164 | 132k | ".symbol_stub"); |
165 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveTData>(".tdata"); |
166 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveText>(".text"); |
167 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveThreadInitFunc>( |
168 | 132k | ".thread_init_func"); |
169 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveTLV>(".tlv"); |
170 | | |
171 | 132k | addDirectiveHandler<&DarwinAsmParser::parseSectionDirectiveIdent>(".ident"); |
172 | 132k | addDirectiveHandler<&DarwinAsmParser::parseVersionMin>( |
173 | 132k | ".watchos_version_min"); |
174 | 132k | addDirectiveHandler<&DarwinAsmParser::parseVersionMin>(".tvos_version_min"); |
175 | 132k | addDirectiveHandler<&DarwinAsmParser::parseVersionMin>(".ios_version_min"); |
176 | 132k | addDirectiveHandler<&DarwinAsmParser::parseVersionMin>( |
177 | 132k | ".macosx_version_min"); |
178 | | |
179 | 132k | LastVersionMinDirective = SMLoc(); |
180 | 132k | } |
181 | | |
182 | | bool parseDirectiveDesc(StringRef, SMLoc); |
183 | | bool parseDirectiveIndirectSymbol(StringRef, SMLoc); |
184 | | bool parseDirectiveDumpOrLoad(StringRef, SMLoc); |
185 | | bool parseDirectiveLsym(StringRef, SMLoc); |
186 | | bool parseDirectiveLinkerOption(StringRef, SMLoc); |
187 | | bool parseDirectiveSection(StringRef, SMLoc); |
188 | | bool parseDirectivePushSection(StringRef, SMLoc); |
189 | | bool parseDirectivePopSection(StringRef, SMLoc); |
190 | | bool parseDirectivePrevious(StringRef, SMLoc); |
191 | | bool parseDirectiveSecureLogReset(StringRef, SMLoc); |
192 | | bool parseDirectiveSecureLogUnique(StringRef, SMLoc); |
193 | | bool parseDirectiveSubsectionsViaSymbols(StringRef, SMLoc); |
194 | | bool parseDirectiveTBSS(StringRef, SMLoc); |
195 | | bool parseDirectiveZerofill(StringRef, SMLoc); |
196 | | bool parseDirectiveDataRegion(StringRef, SMLoc); |
197 | | bool parseDirectiveDataRegionEnd(StringRef, SMLoc); |
198 | | |
199 | | // Named Section Directive |
200 | 5.79k | bool parseSectionDirectiveBss(StringRef, SMLoc) { |
201 | 5.79k | return parseSectionSwitch("__DATA", "__bss"); |
202 | 5.79k | } |
203 | | |
204 | 1.09k | bool parseSectionDirectiveConst(StringRef, SMLoc) { |
205 | 1.09k | return parseSectionSwitch("__TEXT", "__const"); |
206 | 1.09k | } |
207 | 0 | bool parseSectionDirectiveStaticConst(StringRef, SMLoc) { |
208 | 0 | return parseSectionSwitch("__TEXT", "__static_const"); |
209 | 0 | } |
210 | 0 | bool parseSectionDirectiveCString(StringRef, SMLoc) { |
211 | 0 | return parseSectionSwitch("__TEXT","__cstring", |
212 | 0 | MachO::S_CSTRING_LITERALS); |
213 | 0 | } |
214 | 0 | bool parseSectionDirectiveLiteral4(StringRef, SMLoc) { |
215 | 0 | return parseSectionSwitch("__TEXT", "__literal4", |
216 | 0 | MachO::S_4BYTE_LITERALS, 4); |
217 | 0 | } |
218 | 0 | bool parseSectionDirectiveLiteral8(StringRef, SMLoc) { |
219 | 0 | return parseSectionSwitch("__TEXT", "__literal8", |
220 | 0 | MachO::S_8BYTE_LITERALS, 8); |
221 | 0 | } |
222 | 0 | bool parseSectionDirectiveLiteral16(StringRef, SMLoc) { |
223 | 0 | return parseSectionSwitch("__TEXT","__literal16", |
224 | 0 | MachO::S_16BYTE_LITERALS, 16); |
225 | 0 | } |
226 | 4 | bool parseSectionDirectiveConstructor(StringRef, SMLoc) { |
227 | 4 | return parseSectionSwitch("__TEXT","__constructor"); |
228 | 4 | } |
229 | 0 | bool parseSectionDirectiveDestructor(StringRef, SMLoc) { |
230 | 0 | return parseSectionSwitch("__TEXT","__destructor"); |
231 | 0 | } |
232 | 0 | bool parseSectionDirectiveFVMLibInit0(StringRef, SMLoc) { |
233 | 0 | return parseSectionSwitch("__TEXT","__fvmlib_init0"); |
234 | 0 | } |
235 | 0 | bool parseSectionDirectiveFVMLibInit1(StringRef, SMLoc) { |
236 | 0 | return parseSectionSwitch("__TEXT","__fvmlib_init1"); |
237 | 0 | } |
238 | 0 | bool parseSectionDirectiveSymbolStub(StringRef, SMLoc) { |
239 | 0 | return parseSectionSwitch("__TEXT","__symbol_stub", |
240 | 0 | MachO::S_SYMBOL_STUBS | |
241 | 0 | MachO::S_ATTR_PURE_INSTRUCTIONS, |
242 | | // FIXME: Different on PPC and ARM. |
243 | 0 | 0, 16); |
244 | 0 | } |
245 | 0 | bool parseSectionDirectivePICSymbolStub(StringRef, SMLoc) { |
246 | 0 | return parseSectionSwitch("__TEXT","__picsymbol_stub", |
247 | 0 | MachO::S_SYMBOL_STUBS | |
248 | 0 | MachO::S_ATTR_PURE_INSTRUCTIONS, 0, 26); |
249 | 0 | } |
250 | 1.04M | bool parseSectionDirectiveData(StringRef, SMLoc) { |
251 | 1.04M | return parseSectionSwitch("__DATA", "__data"); |
252 | 1.04M | } |
253 | 0 | bool parseSectionDirectiveStaticData(StringRef, SMLoc) { |
254 | 0 | return parseSectionSwitch("__DATA", "__static_data"); |
255 | 0 | } |
256 | 0 | bool parseSectionDirectiveNonLazySymbolPointers(StringRef, SMLoc) { |
257 | 0 | return parseSectionSwitch("__DATA", "__nl_symbol_ptr", |
258 | 0 | MachO::S_NON_LAZY_SYMBOL_POINTERS, 4); |
259 | 0 | } |
260 | 0 | bool parseSectionDirectiveLazySymbolPointers(StringRef, SMLoc) { |
261 | 0 | return parseSectionSwitch("__DATA", "__la_symbol_ptr", |
262 | 0 | MachO::S_LAZY_SYMBOL_POINTERS, 4); |
263 | 0 | } |
264 | 27 | bool parseSectionDirectiveDyld(StringRef, SMLoc) { |
265 | 27 | return parseSectionSwitch("__DATA", "__dyld"); |
266 | 27 | } |
267 | 0 | bool parseSectionDirectiveModInitFunc(StringRef, SMLoc) { |
268 | 0 | return parseSectionSwitch("__DATA", "__mod_init_func", |
269 | 0 | MachO::S_MOD_INIT_FUNC_POINTERS, 4); |
270 | 0 | } |
271 | 0 | bool parseSectionDirectiveModTermFunc(StringRef, SMLoc) { |
272 | 0 | return parseSectionSwitch("__DATA", "__mod_term_func", |
273 | 0 | MachO::S_MOD_TERM_FUNC_POINTERS, 4); |
274 | 0 | } |
275 | 0 | bool parseSectionDirectiveConstData(StringRef, SMLoc) { |
276 | 0 | return parseSectionSwitch("__DATA", "__const"); |
277 | 0 | } |
278 | 0 | bool parseSectionDirectiveObjCClass(StringRef, SMLoc) { |
279 | 0 | return parseSectionSwitch("__OBJC", "__class", |
280 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
281 | 0 | } |
282 | 0 | bool parseSectionDirectiveObjCMetaClass(StringRef, SMLoc) { |
283 | 0 | return parseSectionSwitch("__OBJC", "__meta_class", |
284 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
285 | 0 | } |
286 | 0 | bool parseSectionDirectiveObjCCatClsMeth(StringRef, SMLoc) { |
287 | 0 | return parseSectionSwitch("__OBJC", "__cat_cls_meth", |
288 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
289 | 0 | } |
290 | 0 | bool parseSectionDirectiveObjCCatInstMeth(StringRef, SMLoc) { |
291 | 0 | return parseSectionSwitch("__OBJC", "__cat_inst_meth", |
292 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
293 | 0 | } |
294 | 0 | bool parseSectionDirectiveObjCProtocol(StringRef, SMLoc) { |
295 | 0 | return parseSectionSwitch("__OBJC", "__protocol", |
296 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
297 | 0 | } |
298 | 0 | bool parseSectionDirectiveObjCStringObject(StringRef, SMLoc) { |
299 | 0 | return parseSectionSwitch("__OBJC", "__string_object", |
300 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
301 | 0 | } |
302 | 0 | bool parseSectionDirectiveObjCClsMeth(StringRef, SMLoc) { |
303 | 0 | return parseSectionSwitch("__OBJC", "__cls_meth", |
304 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
305 | 0 | } |
306 | 0 | bool parseSectionDirectiveObjCInstMeth(StringRef, SMLoc) { |
307 | 0 | return parseSectionSwitch("__OBJC", "__inst_meth", |
308 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
309 | 0 | } |
310 | 0 | bool parseSectionDirectiveObjCClsRefs(StringRef, SMLoc) { |
311 | 0 | return parseSectionSwitch("__OBJC", "__cls_refs", |
312 | 0 | MachO::S_ATTR_NO_DEAD_STRIP | |
313 | 0 | MachO::S_LITERAL_POINTERS, 4); |
314 | 0 | } |
315 | 0 | bool parseSectionDirectiveObjCMessageRefs(StringRef, SMLoc) { |
316 | 0 | return parseSectionSwitch("__OBJC", "__message_refs", |
317 | 0 | MachO::S_ATTR_NO_DEAD_STRIP | |
318 | 0 | MachO::S_LITERAL_POINTERS, 4); |
319 | 0 | } |
320 | 0 | bool parseSectionDirectiveObjCSymbols(StringRef, SMLoc) { |
321 | 0 | return parseSectionSwitch("__OBJC", "__symbols", |
322 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
323 | 0 | } |
324 | 0 | bool parseSectionDirectiveObjCCategory(StringRef, SMLoc) { |
325 | 0 | return parseSectionSwitch("__OBJC", "__category", |
326 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
327 | 0 | } |
328 | 0 | bool parseSectionDirectiveObjCClassVars(StringRef, SMLoc) { |
329 | 0 | return parseSectionSwitch("__OBJC", "__class_vars", |
330 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
331 | 0 | } |
332 | 0 | bool parseSectionDirectiveObjCInstanceVars(StringRef, SMLoc) { |
333 | 0 | return parseSectionSwitch("__OBJC", "__instance_vars", |
334 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
335 | 0 | } |
336 | 0 | bool parseSectionDirectiveObjCModuleInfo(StringRef, SMLoc) { |
337 | 0 | return parseSectionSwitch("__OBJC", "__module_info", |
338 | 0 | MachO::S_ATTR_NO_DEAD_STRIP); |
339 | 0 | } |
340 | 0 | bool parseSectionDirectiveObjCClassNames(StringRef, SMLoc) { |
341 | 0 | return parseSectionSwitch("__TEXT", "__cstring", |
342 | 0 | MachO::S_CSTRING_LITERALS); |
343 | 0 | } |
344 | 0 | bool parseSectionDirectiveObjCMethVarTypes(StringRef, SMLoc) { |
345 | 0 | return parseSectionSwitch("__TEXT", "__cstring", |
346 | 0 | MachO::S_CSTRING_LITERALS); |
347 | 0 | } |
348 | 0 | bool parseSectionDirectiveObjCMethVarNames(StringRef, SMLoc) { |
349 | 0 | return parseSectionSwitch("__TEXT", "__cstring", |
350 | 0 | MachO::S_CSTRING_LITERALS); |
351 | 0 | } |
352 | 0 | bool parseSectionDirectiveObjCSelectorStrs(StringRef, SMLoc) { |
353 | 0 | return parseSectionSwitch("__OBJC", "__selector_strs", |
354 | 0 | MachO::S_CSTRING_LITERALS); |
355 | 0 | } |
356 | 9 | bool parseSectionDirectiveTData(StringRef, SMLoc) { |
357 | 9 | return parseSectionSwitch("__DATA", "__thread_data", |
358 | 9 | MachO::S_THREAD_LOCAL_REGULAR); |
359 | 9 | } |
360 | 7 | bool parseSectionDirectiveText(StringRef, SMLoc) { |
361 | 7 | return parseSectionSwitch("__TEXT", "__text", |
362 | 7 | MachO::S_ATTR_PURE_INSTRUCTIONS); |
363 | 7 | } |
364 | 10 | bool parseSectionDirectiveTLV(StringRef, SMLoc) { |
365 | 10 | return parseSectionSwitch("__DATA", "__thread_vars", |
366 | 10 | MachO::S_THREAD_LOCAL_VARIABLES); |
367 | 10 | } |
368 | 3.25k | bool parseSectionDirectiveIdent(StringRef, SMLoc) { |
369 | | // Darwin silently ignores the .ident directive. |
370 | 3.25k | getParser().eatToEndOfStatement(); |
371 | 3.25k | return false; |
372 | 3.25k | } |
373 | 0 | bool parseSectionDirectiveThreadInitFunc(StringRef, SMLoc) { |
374 | 0 | return parseSectionSwitch("__DATA", "__thread_init", |
375 | 0 | MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS); |
376 | 0 | } |
377 | | bool parseVersionMin(StringRef, SMLoc); |
378 | | |
379 | | }; |
380 | | |
381 | | } // end anonymous namespace |
382 | | |
383 | | bool DarwinAsmParser::parseSectionSwitch(const char *Segment, |
384 | | const char *Section, |
385 | | unsigned TAA, unsigned Align, |
386 | 1.04M | unsigned StubSize) { |
387 | 1.04M | if (getLexer().isNot(AsmToken::EndOfStatement)) |
388 | 78 | return TokError("unexpected token in section switching directive"); |
389 | 1.04M | Lex(); |
390 | | |
391 | | // FIXME: Arch specific. |
392 | 1.04M | bool isText = TAA & MachO::S_ATTR_PURE_INSTRUCTIONS; |
393 | 1.04M | getStreamer().SwitchSection(getContext().getMachOSection( |
394 | 1.04M | Segment, Section, TAA, StubSize, |
395 | 1.04M | isText ? SectionKind::getText() : SectionKind::getData())); |
396 | | |
397 | | // Set the implicit alignment, if any. |
398 | | // |
399 | | // FIXME: This isn't really what 'as' does; I think it just uses the implicit |
400 | | // alignment on the section (e.g., if one manually inserts bytes into the |
401 | | // section, then just issuing the section switch directive will not realign |
402 | | // the section. However, this is arguably more reasonable behavior, and there |
403 | | // is no good reason for someone to intentionally emit incorrectly sized |
404 | | // values into the implicitly aligned sections. |
405 | 1.04M | if (Align) |
406 | 0 | getStreamer().EmitValueToAlignment(Align); |
407 | | |
408 | 1.04M | return false; |
409 | 1.04M | } |
410 | | |
411 | | /// parseDirectiveDesc |
412 | | /// ::= .desc identifier , expression |
413 | 616 | bool DarwinAsmParser::parseDirectiveDesc(StringRef, SMLoc) { |
414 | 616 | StringRef Name; |
415 | 616 | if (getParser().parseIdentifier(Name)) |
416 | 508 | return TokError("expected identifier in directive"); |
417 | | |
418 | | // Handle the identifier as the key symbol. |
419 | 108 | MCSymbol *Sym = getContext().getOrCreateSymbol(Name); |
420 | | |
421 | 108 | if (getLexer().isNot(AsmToken::Comma)) |
422 | 14 | return TokError("unexpected token in '.desc' directive"); |
423 | 94 | Lex(); |
424 | | |
425 | 94 | int64_t DescValue; |
426 | 94 | if (getParser().parseAbsoluteExpression(DescValue)) |
427 | 87 | return true; |
428 | | |
429 | 7 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
430 | 7 | return TokError("unexpected token in '.desc' directive"); |
431 | | |
432 | 0 | Lex(); |
433 | | |
434 | | // Set the n_desc field of this Symbol to this DescValue |
435 | 0 | getStreamer().EmitSymbolDesc(Sym, DescValue); |
436 | |
|
437 | 0 | return false; |
438 | 7 | } |
439 | | |
440 | | /// parseDirectiveIndirectSymbol |
441 | | /// ::= .indirect_symbol identifier |
442 | 0 | bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) { |
443 | 0 | const MCSectionMachO *Current = static_cast<const MCSectionMachO*>( |
444 | 0 | getStreamer().getCurrentSection().first); |
445 | 0 | MachO::SectionType SectionType = Current->getType(); |
446 | 0 | if (SectionType != MachO::S_NON_LAZY_SYMBOL_POINTERS && |
447 | 0 | SectionType != MachO::S_LAZY_SYMBOL_POINTERS && |
448 | 0 | SectionType != MachO::S_SYMBOL_STUBS) |
449 | 0 | return Error(Loc, "indirect symbol not in a symbol pointer or stub " |
450 | 0 | "section"); |
451 | | |
452 | 0 | StringRef Name; |
453 | 0 | if (getParser().parseIdentifier(Name)) |
454 | 0 | return TokError("expected identifier in .indirect_symbol directive"); |
455 | | |
456 | 0 | MCSymbol *Sym = getContext().getOrCreateSymbol(Name); |
457 | | |
458 | | // Assembler local symbols don't make any sense here. Complain loudly. |
459 | 0 | if (Sym->isTemporary()) |
460 | 0 | return TokError("non-local symbol required in directive"); |
461 | | |
462 | 0 | if (!getStreamer().EmitSymbolAttribute(Sym, MCSA_IndirectSymbol)) |
463 | 0 | return TokError("unable to emit indirect symbol attribute for: " + Name); |
464 | | |
465 | 0 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
466 | 0 | return TokError("unexpected token in '.indirect_symbol' directive"); |
467 | | |
468 | 0 | Lex(); |
469 | |
|
470 | 0 | return false; |
471 | 0 | } |
472 | | |
473 | | /// parseDirectiveDumpOrLoad |
474 | | /// ::= ( .dump | .load ) "filename" |
475 | | bool DarwinAsmParser::parseDirectiveDumpOrLoad(StringRef Directive, |
476 | 8.86k | SMLoc IDLoc) { |
477 | 8.86k | bool IsDump = Directive == ".dump"; |
478 | 8.86k | if (getLexer().isNot(AsmToken::String)) |
479 | 71 | return TokError("expected string in '.dump' or '.load' directive"); |
480 | | |
481 | 8.79k | Lex(); |
482 | | |
483 | 8.79k | if (getLexer().isNot(AsmToken::EndOfStatement)) |
484 | 51 | return TokError("unexpected token in '.dump' or '.load' directive"); |
485 | | |
486 | 8.74k | Lex(); |
487 | | |
488 | | // FIXME: If/when .dump and .load are implemented they will be done in the |
489 | | // the assembly parser and not have any need for an MCStreamer API. |
490 | 8.74k | if (IsDump) |
491 | 5.94k | return Warning(IDLoc, "ignoring directive .dump for now"); |
492 | 2.80k | else |
493 | 2.80k | return Warning(IDLoc, "ignoring directive .load for now"); |
494 | 8.74k | } |
495 | | |
496 | | /// ParseDirectiveLinkerOption |
497 | | /// ::= .linker_option "string" ( , "string" )* |
498 | 0 | bool DarwinAsmParser::parseDirectiveLinkerOption(StringRef IDVal, SMLoc) { |
499 | 0 | SmallVector<std::string, 4> Args; |
500 | 0 | for (;;) { |
501 | 0 | if (getLexer().isNot(AsmToken::String)) |
502 | 0 | return TokError("expected string in '" + Twine(IDVal) + "' directive"); |
503 | | |
504 | 0 | std::string Data; |
505 | 0 | if (getParser().parseEscapedString(Data)) |
506 | 0 | return true; |
507 | | |
508 | 0 | Args.push_back(Data); |
509 | |
|
510 | 0 | Lex(); |
511 | 0 | if (getLexer().is(AsmToken::EndOfStatement)) |
512 | 0 | break; |
513 | | |
514 | 0 | if (getLexer().isNot(AsmToken::Comma)) |
515 | 0 | return TokError("unexpected token in '" + Twine(IDVal) + "' directive"); |
516 | 0 | Lex(); |
517 | 0 | } |
518 | | |
519 | 0 | getStreamer().EmitLinkerOptions(Args); |
520 | 0 | return false; |
521 | 0 | } |
522 | | |
523 | | /// parseDirectiveLsym |
524 | | /// ::= .lsym identifier , expression |
525 | 232 | bool DarwinAsmParser::parseDirectiveLsym(StringRef, SMLoc) { |
526 | 232 | StringRef Name; |
527 | 232 | if (getParser().parseIdentifier(Name)) |
528 | 62 | return TokError("expected identifier in directive"); |
529 | | |
530 | | // Handle the identifier as the key symbol. |
531 | 170 | MCSymbol *Sym = getContext().getOrCreateSymbol(Name); |
532 | | |
533 | 170 | if (getLexer().isNot(AsmToken::Comma)) |
534 | 12 | return TokError("unexpected token in '.lsym' directive"); |
535 | 158 | Lex(); |
536 | | |
537 | 158 | const MCExpr *Value; |
538 | 158 | if (getParser().parseExpression(Value)) |
539 | 136 | return true; |
540 | | |
541 | 22 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
542 | 7 | return TokError("unexpected token in '.lsym' directive"); |
543 | | |
544 | 15 | Lex(); |
545 | | |
546 | | // We don't currently support this directive. |
547 | | // |
548 | | // FIXME: Diagnostic location! |
549 | 15 | (void) Sym; |
550 | 15 | return TokError("directive '.lsym' is unsupported"); |
551 | 22 | } |
552 | | |
553 | | /// parseDirectiveSection: |
554 | | /// ::= .section identifier (',' identifier)* |
555 | 6.88k | bool DarwinAsmParser::parseDirectiveSection(StringRef, SMLoc) { |
556 | 6.88k | SMLoc Loc = getLexer().getLoc(); |
557 | | |
558 | 6.88k | StringRef SectionName; |
559 | 6.88k | if (getParser().parseIdentifier(SectionName)) |
560 | 137 | return Error(Loc, "expected identifier after '.section' directive"); |
561 | | |
562 | | // Verify there is a following comma. |
563 | 6.75k | if (!getLexer().is(AsmToken::Comma)) |
564 | 48 | return TokError("unexpected token in '.section' directive"); |
565 | | |
566 | 6.70k | std::string SectionSpec = SectionName; |
567 | 6.70k | SectionSpec += ","; |
568 | | |
569 | | // Add all the tokens until the end of the line, ParseSectionSpecifier will |
570 | | // handle this. |
571 | 6.70k | StringRef EOL = getLexer().LexUntilEndOfStatement(); |
572 | 6.70k | SectionSpec.append(EOL.begin(), EOL.end()); |
573 | | |
574 | 6.70k | Lex(); |
575 | 6.70k | if (getLexer().isNot(AsmToken::EndOfStatement)) |
576 | 23 | return TokError("unexpected token in '.section' directive"); |
577 | 6.67k | Lex(); |
578 | | |
579 | | |
580 | 6.67k | StringRef Segment, Section; |
581 | 6.67k | unsigned StubSize; |
582 | 6.67k | unsigned TAA; |
583 | 6.67k | bool TAAParsed; |
584 | 6.67k | std::string ErrorStr = |
585 | 6.67k | MCSectionMachO::ParseSectionSpecifier(SectionSpec, Segment, Section, |
586 | 6.67k | TAA, TAAParsed, StubSize); |
587 | | |
588 | 6.67k | if (!ErrorStr.empty()) |
589 | 805 | return Error(Loc, ErrorStr.c_str()); |
590 | | |
591 | | // Issue a warning if the target is not powerpc and Section is a *coal* section. |
592 | 5.87k | Triple TT = getParser().getContext().getObjectFileInfo()->getTargetTriple(); |
593 | 5.87k | Triple::ArchType ArchTy = TT.getArch(); |
594 | | |
595 | 5.87k | if (ArchTy != Triple::ppc && ArchTy != Triple::ppc64) { |
596 | 5.51k | StringRef NonCoalSection = StringSwitch<StringRef>(Section) |
597 | 5.51k | .Case("__textcoal_nt", "__text") |
598 | 5.51k | .Case("__const_coal", "__const") |
599 | 5.51k | .Case("__datacoal_nt", "__data") |
600 | 5.51k | .Default(Section); |
601 | | |
602 | 5.51k | if (!Section.equals(NonCoalSection)) { |
603 | 56 | StringRef SectionVal(Loc.getPointer()); |
604 | 56 | size_t B = SectionVal.find(',') + 1, E = SectionVal.find(',', B); |
605 | 56 | SMLoc BLoc = SMLoc::getFromPointer(SectionVal.data() + B); |
606 | 56 | SMLoc ELoc = SMLoc::getFromPointer(SectionVal.data() + E); |
607 | 56 | getParser().Warning(Loc, "section \"" + Section + "\" is deprecated", |
608 | 56 | SMRange(BLoc, ELoc)); |
609 | 56 | getParser().Note(Loc, "change section name to \"" + NonCoalSection + |
610 | 56 | "\"", SMRange(BLoc, ELoc)); |
611 | 56 | } |
612 | 5.51k | } |
613 | | |
614 | | // FIXME: Arch specific. |
615 | 5.87k | bool isText = Segment == "__TEXT"; // FIXME: Hack. |
616 | 5.87k | getStreamer().SwitchSection(getContext().getMachOSection( |
617 | 5.87k | Segment, Section, TAA, StubSize, |
618 | 5.87k | isText ? SectionKind::getText() : SectionKind::getData())); |
619 | 5.87k | return false; |
620 | 6.67k | } |
621 | | |
622 | | /// ParseDirectivePushSection: |
623 | | /// ::= .pushsection identifier (',' identifier)* |
624 | 0 | bool DarwinAsmParser::parseDirectivePushSection(StringRef S, SMLoc Loc) { |
625 | 0 | getStreamer().PushSection(); |
626 | |
|
627 | 0 | if (parseDirectiveSection(S, Loc)) { |
628 | 0 | getStreamer().PopSection(); |
629 | 0 | return true; |
630 | 0 | } |
631 | | |
632 | 0 | return false; |
633 | 0 | } |
634 | | |
635 | | /// ParseDirectivePopSection: |
636 | | /// ::= .popsection |
637 | 0 | bool DarwinAsmParser::parseDirectivePopSection(StringRef, SMLoc) { |
638 | 0 | if (!getStreamer().PopSection()) |
639 | 0 | return TokError(".popsection without corresponding .pushsection"); |
640 | 0 | return false; |
641 | 0 | } |
642 | | |
643 | | /// ParseDirectivePrevious: |
644 | | /// ::= .previous |
645 | 0 | bool DarwinAsmParser::parseDirectivePrevious(StringRef DirName, SMLoc) { |
646 | 0 | MCSectionSubPair PreviousSection = getStreamer().getPreviousSection(); |
647 | 0 | if (!PreviousSection.first) |
648 | 0 | return TokError(".previous without corresponding .section"); |
649 | 0 | getStreamer().SwitchSection(PreviousSection.first, PreviousSection.second); |
650 | 0 | return false; |
651 | 0 | } |
652 | | |
653 | | /// ParseDirectiveSecureLogUnique |
654 | | /// ::= .secure_log_unique ... message ... |
655 | 0 | bool DarwinAsmParser::parseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) { |
656 | 0 | StringRef LogMessage = getParser().parseStringToEndOfStatement(); |
657 | 0 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
658 | 0 | return TokError("unexpected token in '.secure_log_unique' directive"); |
659 | | |
660 | 0 | if (getContext().getSecureLogUsed()) |
661 | 0 | return Error(IDLoc, ".secure_log_unique specified multiple times"); |
662 | | |
663 | | // Get the secure log path. |
664 | 0 | const char *SecureLogFile = getContext().getSecureLogFile(); |
665 | 0 | if (!SecureLogFile) |
666 | 0 | return Error(IDLoc, ".secure_log_unique used but AS_SECURE_LOG_FILE " |
667 | 0 | "environment variable unset."); |
668 | | |
669 | | // Open the secure log file if we haven't already. |
670 | 0 | raw_fd_ostream *OS = getContext().getSecureLog(); |
671 | 0 | if (!OS) { |
672 | 0 | std::error_code EC; |
673 | 0 | auto NewOS = llvm_ks::make_unique<raw_fd_ostream>( |
674 | 0 | SecureLogFile, EC, sys::fs::F_Append | sys::fs::F_Text); |
675 | 0 | if (EC) |
676 | 0 | return Error(IDLoc, Twine("can't open secure log file: ") + |
677 | 0 | SecureLogFile + " (" + EC.message() + ")"); |
678 | 0 | OS = NewOS.get(); |
679 | 0 | getContext().setSecureLog(std::move(NewOS)); |
680 | 0 | } |
681 | | |
682 | | // Write the message. |
683 | 0 | unsigned CurBuf = getSourceManager().FindBufferContainingLoc(IDLoc); |
684 | 0 | *OS << getSourceManager().getBufferInfo(CurBuf).Buffer->getBufferIdentifier() |
685 | 0 | << ":" << getSourceManager().FindLineNumber(IDLoc, CurBuf) << ":" |
686 | 0 | << LogMessage + "\n"; |
687 | |
|
688 | 0 | getContext().setSecureLogUsed(true); |
689 | |
|
690 | 0 | return false; |
691 | 0 | } |
692 | | |
693 | | /// ParseDirectiveSecureLogReset |
694 | | /// ::= .secure_log_reset |
695 | 0 | bool DarwinAsmParser::parseDirectiveSecureLogReset(StringRef, SMLoc IDLoc) { |
696 | 0 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
697 | 0 | return TokError("unexpected token in '.secure_log_reset' directive"); |
698 | | |
699 | 0 | Lex(); |
700 | |
|
701 | 0 | getContext().setSecureLogUsed(false); |
702 | |
|
703 | 0 | return false; |
704 | 0 | } |
705 | | |
706 | | /// parseDirectiveSubsectionsViaSymbols |
707 | | /// ::= .subsections_via_symbols |
708 | 0 | bool DarwinAsmParser::parseDirectiveSubsectionsViaSymbols(StringRef, SMLoc) { |
709 | 0 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
710 | 0 | return TokError("unexpected token in '.subsections_via_symbols' directive"); |
711 | | |
712 | 0 | Lex(); |
713 | |
|
714 | 0 | getStreamer().EmitAssemblerFlag(MCAF_SubsectionsViaSymbols); |
715 | |
|
716 | 0 | return false; |
717 | 0 | } |
718 | | |
719 | | /// ParseDirectiveTBSS |
720 | | /// ::= .tbss identifier, size, align |
721 | 6.31k | bool DarwinAsmParser::parseDirectiveTBSS(StringRef, SMLoc) { |
722 | 6.31k | SMLoc IDLoc = getLexer().getLoc(); |
723 | 6.31k | StringRef Name; |
724 | 6.31k | if (getParser().parseIdentifier(Name)) |
725 | 4.93k | return TokError("expected identifier in directive"); |
726 | | |
727 | | // Handle the identifier as the key symbol. |
728 | 1.37k | MCSymbol *Sym = getContext().getOrCreateSymbol(Name); |
729 | | |
730 | 1.37k | if (getLexer().isNot(AsmToken::Comma)) |
731 | 23 | return TokError("unexpected token in directive"); |
732 | 1.35k | Lex(); |
733 | | |
734 | 1.35k | int64_t Size; |
735 | 1.35k | SMLoc SizeLoc = getLexer().getLoc(); |
736 | 1.35k | if (getParser().parseAbsoluteExpression(Size)) |
737 | 602 | return true; |
738 | | |
739 | 754 | int64_t Pow2Alignment = 0; |
740 | 754 | SMLoc Pow2AlignmentLoc; |
741 | 754 | if (getLexer().is(AsmToken::Comma)) { |
742 | 477 | Lex(); |
743 | 477 | Pow2AlignmentLoc = getLexer().getLoc(); |
744 | 477 | if (getParser().parseAbsoluteExpression(Pow2Alignment)) |
745 | 40 | return true; |
746 | 477 | } |
747 | | |
748 | 714 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
749 | 9 | return TokError("unexpected token in '.tbss' directive"); |
750 | | |
751 | 705 | Lex(); |
752 | | |
753 | 705 | if (Size < 0) |
754 | 276 | return Error(SizeLoc, "invalid '.tbss' directive size, can't be less than" |
755 | 276 | "zero"); |
756 | | |
757 | | // FIXME: Diagnose overflow. |
758 | 429 | if (Pow2Alignment < 0) |
759 | 429 | return Error(Pow2AlignmentLoc, "invalid '.tbss' alignment, can't be less" |
760 | 429 | "than zero"); |
761 | | |
762 | 0 | if (!Sym->isUndefined()) |
763 | 0 | return Error(IDLoc, "invalid symbol redefinition"); |
764 | | |
765 | 0 | getStreamer().EmitTBSSSymbol(getContext().getMachOSection( |
766 | 0 | "__DATA", "__thread_bss", |
767 | 0 | MachO::S_THREAD_LOCAL_ZEROFILL, |
768 | 0 | 0, SectionKind::getThreadBSS()), |
769 | 0 | Sym, Size, 1 << Pow2Alignment); |
770 | |
|
771 | 0 | return false; |
772 | 0 | } |
773 | | |
774 | | /// ParseDirectiveZerofill |
775 | | /// ::= .zerofill segname , sectname [, identifier , size_expression [ |
776 | | /// , align_expression ]] |
777 | 0 | bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) { |
778 | 0 | StringRef Segment; |
779 | 0 | if (getParser().parseIdentifier(Segment)) |
780 | 0 | return TokError("expected segment name after '.zerofill' directive"); |
781 | | |
782 | 0 | if (getLexer().isNot(AsmToken::Comma)) |
783 | 0 | return TokError("unexpected token in directive"); |
784 | 0 | Lex(); |
785 | |
|
786 | 0 | StringRef Section; |
787 | 0 | if (getParser().parseIdentifier(Section)) |
788 | 0 | return TokError("expected section name after comma in '.zerofill' " |
789 | 0 | "directive"); |
790 | | |
791 | | // If this is the end of the line all that was wanted was to create the |
792 | | // the section but with no symbol. |
793 | 0 | if (getLexer().is(AsmToken::EndOfStatement)) { |
794 | | // Create the zerofill section but no symbol |
795 | 0 | getStreamer().EmitZerofill(getContext().getMachOSection( |
796 | 0 | Segment, Section, MachO::S_ZEROFILL, |
797 | 0 | 0, SectionKind::getBSS())); |
798 | 0 | return false; |
799 | 0 | } |
800 | | |
801 | 0 | if (getLexer().isNot(AsmToken::Comma)) |
802 | 0 | return TokError("unexpected token in directive"); |
803 | 0 | Lex(); |
804 | |
|
805 | 0 | SMLoc IDLoc = getLexer().getLoc(); |
806 | 0 | StringRef IDStr; |
807 | 0 | if (getParser().parseIdentifier(IDStr)) |
808 | 0 | return TokError("expected identifier in directive"); |
809 | | |
810 | | // handle the identifier as the key symbol. |
811 | 0 | MCSymbol *Sym = getContext().getOrCreateSymbol(IDStr); |
812 | |
|
813 | 0 | if (getLexer().isNot(AsmToken::Comma)) |
814 | 0 | return TokError("unexpected token in directive"); |
815 | 0 | Lex(); |
816 | |
|
817 | 0 | int64_t Size; |
818 | 0 | SMLoc SizeLoc = getLexer().getLoc(); |
819 | 0 | if (getParser().parseAbsoluteExpression(Size)) |
820 | 0 | return true; |
821 | | |
822 | 0 | int64_t Pow2Alignment = 0; |
823 | 0 | SMLoc Pow2AlignmentLoc; |
824 | 0 | if (getLexer().is(AsmToken::Comma)) { |
825 | 0 | Lex(); |
826 | 0 | Pow2AlignmentLoc = getLexer().getLoc(); |
827 | 0 | if (getParser().parseAbsoluteExpression(Pow2Alignment)) |
828 | 0 | return true; |
829 | 0 | } |
830 | | |
831 | 0 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
832 | 0 | return TokError("unexpected token in '.zerofill' directive"); |
833 | | |
834 | 0 | Lex(); |
835 | |
|
836 | 0 | if (Size < 0) |
837 | 0 | return Error(SizeLoc, "invalid '.zerofill' directive size, can't be less " |
838 | 0 | "than zero"); |
839 | | |
840 | | // NOTE: The alignment in the directive is a power of 2 value, the assembler |
841 | | // may internally end up wanting an alignment in bytes. |
842 | | // FIXME: Diagnose overflow. |
843 | 0 | if (Pow2Alignment < 0) |
844 | 0 | return Error(Pow2AlignmentLoc, "invalid '.zerofill' directive alignment, " |
845 | 0 | "can't be less than zero"); |
846 | | |
847 | 0 | if (!Sym->isUndefined()) |
848 | 0 | return Error(IDLoc, "invalid symbol redefinition"); |
849 | | |
850 | | // Create the zerofill Symbol with Size and Pow2Alignment |
851 | | // |
852 | | // FIXME: Arch specific. |
853 | 0 | getStreamer().EmitZerofill(getContext().getMachOSection( |
854 | 0 | Segment, Section, MachO::S_ZEROFILL, |
855 | 0 | 0, SectionKind::getBSS()), |
856 | 0 | Sym, Size, 1 << Pow2Alignment); |
857 | |
|
858 | 0 | return false; |
859 | 0 | } |
860 | | |
861 | | /// ParseDirectiveDataRegion |
862 | | /// ::= .data_region [ ( jt8 | jt16 | jt32 ) ] |
863 | 0 | bool DarwinAsmParser::parseDirectiveDataRegion(StringRef, SMLoc) { |
864 | 0 | if (getLexer().is(AsmToken::EndOfStatement)) { |
865 | 0 | Lex(); |
866 | 0 | getStreamer().EmitDataRegion(MCDR_DataRegion); |
867 | 0 | return false; |
868 | 0 | } |
869 | 0 | StringRef RegionType; |
870 | 0 | SMLoc Loc = getParser().getTok().getLoc(); |
871 | 0 | if (getParser().parseIdentifier(RegionType)) |
872 | 0 | return TokError("expected region type after '.data_region' directive"); |
873 | 0 | int Kind = StringSwitch<int>(RegionType) |
874 | 0 | .Case("jt8", MCDR_DataRegionJT8) |
875 | 0 | .Case("jt16", MCDR_DataRegionJT16) |
876 | 0 | .Case("jt32", MCDR_DataRegionJT32) |
877 | 0 | .Default(-1); |
878 | 0 | if (Kind == -1) |
879 | 0 | return Error(Loc, "unknown region type in '.data_region' directive"); |
880 | 0 | Lex(); |
881 | |
|
882 | 0 | getStreamer().EmitDataRegion((MCDataRegionType)Kind); |
883 | 0 | return false; |
884 | 0 | } |
885 | | |
886 | | /// ParseDirectiveDataRegionEnd |
887 | | /// ::= .end_data_region |
888 | 0 | bool DarwinAsmParser::parseDirectiveDataRegionEnd(StringRef, SMLoc) { |
889 | 0 | if (getLexer().isNot(AsmToken::EndOfStatement)) |
890 | 0 | return TokError("unexpected token in '.end_data_region' directive"); |
891 | | |
892 | 0 | Lex(); |
893 | 0 | getStreamer().EmitDataRegion(MCDR_DataRegionEnd); |
894 | 0 | return false; |
895 | 0 | } |
896 | | |
897 | | /// parseVersionMin |
898 | | /// ::= .ios_version_min major,minor[,update] |
899 | | /// ::= .macosx_version_min major,minor[,update] |
900 | 0 | bool DarwinAsmParser::parseVersionMin(StringRef Directive, SMLoc Loc) { |
901 | 0 | int64_t Major = 0, Minor = 0, Update = 0; |
902 | 0 | int Kind = StringSwitch<int>(Directive) |
903 | 0 | .Case(".watchos_version_min", MCVM_WatchOSVersionMin) |
904 | 0 | .Case(".tvos_version_min", MCVM_TvOSVersionMin) |
905 | 0 | .Case(".ios_version_min", MCVM_IOSVersionMin) |
906 | 0 | .Case(".macosx_version_min", MCVM_OSXVersionMin); |
907 | | // Get the major version number. |
908 | 0 | if (getLexer().isNot(AsmToken::Integer)) |
909 | 0 | return TokError("invalid OS major version number"); |
910 | 0 | bool valid; |
911 | 0 | Major = getLexer().getTok().getIntVal(valid); |
912 | 0 | if (Major > 65535 || Major <= 0) |
913 | 0 | return TokError("invalid OS major version number"); |
914 | 0 | Lex(); |
915 | 0 | if (getLexer().isNot(AsmToken::Comma)) |
916 | 0 | return TokError("minor OS version number required, comma expected"); |
917 | 0 | Lex(); |
918 | | // Get the minor version number. |
919 | 0 | if (getLexer().isNot(AsmToken::Integer)) |
920 | 0 | return TokError("invalid OS minor version number"); |
921 | 0 | Minor = getLexer().getTok().getIntVal(valid); |
922 | 0 | if (Minor > 255 || Minor < 0) |
923 | 0 | return TokError("invalid OS minor version number"); |
924 | 0 | Lex(); |
925 | | // Get the update level, if specified |
926 | 0 | if (getLexer().isNot(AsmToken::EndOfStatement)) { |
927 | 0 | if (getLexer().isNot(AsmToken::Comma)) |
928 | 0 | return TokError("invalid update specifier, comma expected"); |
929 | 0 | Lex(); |
930 | 0 | if (getLexer().isNot(AsmToken::Integer)) |
931 | 0 | return TokError("invalid OS update number"); |
932 | 0 | Update = getLexer().getTok().getIntVal(valid); |
933 | 0 | if (Update > 255 || Update < 0) |
934 | 0 | return TokError("invalid OS update number"); |
935 | 0 | Lex(); |
936 | 0 | } |
937 | | |
938 | 0 | const Triple &T = getContext().getObjectFileInfo()->getTargetTriple(); |
939 | 0 | Triple::OSType ExpectedOS = Triple::UnknownOS; |
940 | 0 | switch ((MCVersionMinType)Kind) { |
941 | 0 | case MCVM_WatchOSVersionMin: ExpectedOS = Triple::WatchOS; break; |
942 | 0 | case MCVM_TvOSVersionMin: ExpectedOS = Triple::TvOS; break; |
943 | 0 | case MCVM_IOSVersionMin: ExpectedOS = Triple::IOS; break; |
944 | 0 | case MCVM_OSXVersionMin: ExpectedOS = Triple::MacOSX; break; |
945 | 0 | } |
946 | 0 | if (T.getOS() != ExpectedOS) |
947 | 0 | Warning(Loc, Directive + " should only be used for " + |
948 | 0 | Triple::getOSTypeName(ExpectedOS) + " targets"); |
949 | |
|
950 | 0 | if (LastVersionMinDirective.isValid()) { |
951 | 0 | Warning(Loc, "overriding previous version_min directive"); |
952 | 0 | Note(LastVersionMinDirective, "previous definition is here"); |
953 | 0 | } |
954 | 0 | LastVersionMinDirective = Loc; |
955 | | |
956 | | // We've parsed a correct version specifier, so send it to the streamer. |
957 | 0 | getStreamer().EmitVersionMin((MCVersionMinType)Kind, Major, Minor, Update); |
958 | |
|
959 | 0 | return false; |
960 | 0 | } |
961 | | |
962 | | namespace llvm_ks { |
963 | | |
964 | 132k | MCAsmParserExtension *createDarwinAsmParser() { |
965 | 132k | return new DarwinAsmParser; |
966 | 132k | } |
967 | | |
968 | | } // end llvm namespace |