[PATCH] D19705: ELF: Add "fast link" mode.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 19:27:29 PDT 2016


ruiu updated this revision to Diff 55522.
ruiu added a comment.

- Update as per Davide's comment.


http://reviews.llvm.org/D19705

Files:
  ELF/Driver.cpp
  ELF/InputFiles.cpp

Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -143,6 +143,12 @@
 
 template <class ELFT> static bool shouldMerge(const typename ELFT::Shdr &Sec) {
   typedef typename ELFT::uint uintX_t;
+
+  // We don't merge sections if -O0 (default is -O1). This makes
+  // the linker about 2x faster, although the output will be bigger.
+  if (Config->Optimize == 0)
+    return false;
+
   uintX_t Flags = Sec.sh_flags;
   if (!(Flags & SHF_MERGE))
     return false;
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -349,7 +349,7 @@
   Config->SoName = getString(Args, OPT_soname);
   Config->Sysroot = getString(Args, OPT_sysroot);
 
-  Config->Optimize = getInteger(Args, OPT_O, 0);
+  Config->Optimize = getInteger(Args, OPT_O, 1);
   Config->LtoO = getInteger(Args, OPT_lto_O, 2);
   if (Config->LtoO > 3)
     error("invalid optimization level for LTO: " + getString(Args, OPT_lto_O));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19705.55522.patch
Type: text/x-patch
Size: 1060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160429/d49207ec/attachment.bin>


More information about the llvm-commits mailing list