return true;
}
+ enum {
+ COFF = (1 << MCObjectFileInfo::IsCOFF),
+ ELF = (1 << MCObjectFileInfo::IsELF),
+ MACHO = (1 << MCObjectFileInfo::IsMachO)
+ };
static const struct PrefixEntry {
const char *Spelling;
ARMMCExpr::VariantKind VariantKind;
+ uint8_t SupportedFormats;
} PrefixEntries[] = {
- {"lower16", ARMMCExpr::VK_ARM_LO16}, {"upper16", ARMMCExpr::VK_ARM_HI16},
+ { "lower16", ARMMCExpr::VK_ARM_LO16, COFF | ELF | MACHO },
+ { "upper16", ARMMCExpr::VK_ARM_HI16, COFF | ELF | MACHO },
};
StringRef IDVal = Parser.getTok().getIdentifier();
return true;
}
+ uint8_t CurrentFormat;
+ switch (getContext().getObjectFileInfo()->getObjectFileType()) {
+ case MCObjectFileInfo::IsMachO:
+ CurrentFormat = MACHO;
+ break;
+ case MCObjectFileInfo::IsELF:
+ CurrentFormat = ELF;
+ break;
+ case MCObjectFileInfo::IsCOFF:
+ CurrentFormat = COFF;
+ break;
+ }
+
+ if (~Prefix->SupportedFormats & CurrentFormat) {
+ Error(Parser.getTok().getLoc(),
+ "cannot represent relocation in the current file format");
+ return true;
+ }
+
RefKind = Prefix->VariantKind;
Parser.Lex();
/// parseDirective parses the arm specific directives
bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) {
- Triple::ObjectFormatType Format =
- getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat();
- bool IsMachO = Format == Triple::MachO;
- bool IsCOFF = Format == Triple::COFF;
+ const MCObjectFileInfo::Environment Format =
+ getContext().getObjectFileInfo()->getObjectFileType();
+ bool IsMachO = Format == MCObjectFileInfo::IsMachO;
+ bool IsCOFF = Format == MCObjectFileInfo::IsCOFF;
StringRef IDVal = DirectiveID.getIdentifier();
if (IDVal == ".word")
/// ::= .thumbfunc symbol_name
bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
MCAsmParser &Parser = getParser();
- Triple::ObjectFormatType Format =
- getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat();
- bool IsMachO = Format == Triple::MachO;
+ const auto Format = getContext().getObjectFileInfo()->getObjectFileType();
+ bool IsMachO = Format == MCObjectFileInfo::IsMachO;
// Darwin asm has (optionally) function name after .thumb_func direction
// ELF doesn't