[PATCH] D47127: [RISCV] Default enable RISCV linker relaxation

Shiva Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 17 07:44:42 PST 2019


shiva0217 updated this revision to Diff 187160.
shiva0217 changed the repository for this revision from rL LLVM to rC Clang.
shiva0217 edited projects, added clang; removed LLVM.
shiva0217 added a comment.

Update patch to address Alex's comment.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47127/new/

https://reviews.llvm.org/D47127

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


Index: test/Driver/riscv-features.c
===================================================================
--- test/Driver/riscv-features.c
+++ test/Driver/riscv-features.c
@@ -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"
Index: lib/Driver/ToolChains/Arch/RISCV.cpp
===================================================================
--- lib/Driver/ToolChains/Arch/RISCV.cpp
+++ lib/Driver/ToolChains/Arch/RISCV.cpp
@@ -364,6 +364,18 @@
     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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47127.187160.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190217/b68b4cd2/attachment.bin>


More information about the cfe-commits mailing list