Просмотр исходного кода

Enable mold linker only under flag
commit_hash:88f3c9f91eafb63005672effecfca95cd50444b5

nechda 4 месяцев назад
Родитель
Сommit
78f8d3bf9f
2 измененных файлов с 5 добавлено и 1 удалено
  1. 1 1
      build/ymake.core.conf
  2. 4 0
      build/ymake_conf.py

+ 1 - 1
build/ymake.core.conf

@@ -818,7 +818,7 @@ _LINKER_ID=
 # GCC does not support -fuse-ld with an executable path,
 # only -fuse-ld=gold or -fuse-ld=lld.
 when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
-    when ($_LINKER_ID in [ "gold", "lld" ]) {
+    when ($_LINKER_ID in [ "gold", "lld", "mold" ]) {
         PEERDIR+=build/platform/${_LINKER_ID}
     }
 }

+ 4 - 0
build/ymake_conf.py

@@ -1640,6 +1640,7 @@ class Linker(object):
     BFD = 'bfd'
     LLD = 'lld'
     GOLD = 'gold'
+    MOLD = 'mold'
 
     def __init__(self, tc, build):
         """
@@ -1651,6 +1652,9 @@ class Linker(object):
         self.type = self._get_default_linker_type()
 
     def _get_default_linker_type(self):
+        if (self.build.host.is_linux or self.build.host.is_macos) and is_positive('USE_MOLD_LINKER'):
+            return Linker.MOLD
+
         if not self.tc.is_from_arcadia or is_positive('EXPORT_CMAKE'):
             # External (e.g. system) toolchain: disable linker selection logic
             return None