[RISCV] Default enable RISCV linker relaxation

Differential Revision: https://reviews.llvm.org/D47127

llvm-svn: 354222
This commit is contained in:
Shiva Chen 2019-02-17 16:05:51 +00:00
parent bee2073542
commit e3aaeabb6d
2 changed files with 13 additions and 1 deletions

View File

@ -364,6 +364,18 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const ArgList &Args,
getExtensionFeatures(D, Args, Features, MArch, OtherExts);
}
// -mrelax is default, unless -mno-relax is specified.
bool Relax = true;
if (auto *A = Args.getLastArg(options::OPT_mrelax, options::OPT_mno_relax)) {
if (A->getOption().matches(options::OPT_mno_relax)) {
Relax = false;
Features.push_back("-relax");
}
}
if (Relax)
Features.push_back("+relax");
// Now add any that the user explicitly requested on the command line,
// which may override the defaults.
handleTargetFeaturesGroup(Args, Features, options::OPT_m_riscv_Features_Group);

View File

@ -9,5 +9,5 @@
// RELAX: "-target-feature" "+relax"
// NO-RELAX: "-target-feature" "-relax"
// DEFAULT-NOT: "-target-feature" "+relax"
// DEFAULT: "-target-feature" "+relax"
// DEFAULT-NOT: "-target-feature" "-relax"