Author: shiva Date: Sun Feb 17 08:05:51 2019 New Revision: 354222 URL: http://llvm.org/viewvc/llvm-project?rev=354222&view=rev Log: [RISCV] Default enable RISCV linker relaxation
Differential Revision: https://reviews.llvm.org/D47127 Modified: cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp cfe/trunk/test/Driver/riscv-features.c Modified: cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp?rev=354222&r1=354221&r2=354222&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp Sun Feb 17 08:05:51 2019 @@ -364,6 +364,18 @@ void riscv::getRISCVTargetFeatures(const 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); Modified: cfe/trunk/test/Driver/riscv-features.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/riscv-features.c?rev=354222&r1=354221&r2=354222&view=diff ============================================================================== --- cfe/trunk/test/Driver/riscv-features.c (original) +++ cfe/trunk/test/Driver/riscv-features.c Sun Feb 17 08:05:51 2019 @@ -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" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits