]> granicus.if.org Git - clang/commitdiff
[RISCV] Default enable RISCV linker relaxation
authorShiva Chen <shiva0217@gmail.com>
Sun, 17 Feb 2019 16:05:51 +0000 (16:05 +0000)
committerShiva Chen <shiva0217@gmail.com>
Sun, 17 Feb 2019 16:05:51 +0000 (16:05 +0000)
Differential Revision: https://reviews.llvm.org/D47127

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354222 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Arch/RISCV.cpp
test/Driver/riscv-features.c

index e40911f4dbff378e8886a1ad70769ed4cdad865a..b5cee381e1f74999576a17a946afeb8338df7625 100644 (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);
index 95f84f31c611582f69ff2e74a148128af921c69e..bdf9ef4084c83d9209643f0295cd7bc0e7e22445 100644 (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"