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