[BOLT] Add mattr options to AArch64 target

Summary:
Make the AArch64 subtarget enable all features, so the disassembler
won't choke on extension instructions.

(cherry picked from FBD9477066)
This commit is contained in:
Rafael Auler 2018-08-22 18:47:39 -07:00 committed by Maksim Panchenko
parent 9c4fcafa37
commit af1177d99f
1 changed files with 5 additions and 1 deletions

View File

@ -628,12 +628,16 @@ createBinaryContext(ELFObjectFileBase *File, DataReader &DR,
std::string ArchName;
std::string TripleName;
llvm::Triple::ArchType Arch = (llvm::Triple::ArchType)File->getArch();
std::string FeaturesStr;
if (Arch == llvm::Triple::x86_64) {
ArchName = "x86-64";
TripleName = "x86_64-unknown-linux";
FeaturesStr = "";
} else if (Arch == llvm::Triple::aarch64) {
ArchName = "aarch64";
TripleName = "aarch64-unknown-linux";
FeaturesStr = "+armv8.1a,+armv8.2a,+armv8.3a,+fp-armv8,+neon,+crypto,"
"+dotprod,+crc,+lse,+ras,+rdm,+fullfp16,+spe,+fuse-aes,+svr,+rcpc";
} else {
errs() << "BOLT-ERROR: Unrecognized machine in ELF file.\n";
return nullptr;
@ -665,7 +669,7 @@ createBinaryContext(ELFObjectFileBase *File, DataReader &DR,
}
std::unique_ptr<const MCSubtargetInfo> STI(
TheTarget->createMCSubtargetInfo(TripleName, "", ""));
TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
if (!STI) {
errs() << "BOLT-ERROR: no subtarget info for target " << TripleName << "\n";
return nullptr;