This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 03 of 10] binutils/binutils: add option to enable gold


# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
# Date 1293491493 -3600
# Node ID b86c48da06be1df5e03921571310caf70136049a
# Parent  0377ec14ac23f0342e2b938f1a4c15d7e3a20db8
binutils/binutils: add option to enable gold

gold is a new, optimised, multi-threaded linker with support
for plugins.

Add support for gold starting with binutils 2.21. Although 2.20
also had gold, the configure flags have changed, and supporting
2.20 would be a mess in the code.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>

diff --git a/config/binutils/binutils.in b/config/binutils/binutils.in
--- a/config/binutils/binutils.in
+++ b/config/binutils/binutils.in
@@ -61,6 +61,72 @@
 
 config BINUTILS_2_21_or_later
     bool
+    select BINUTILS_HAS_GOLD
+
+config BINUTILS_HAS_GOLD
+    bool
+
+if BINUTILS_HAS_GOLD
+
+choice
+    bool
+    prompt "Linkers to enable"
+
+config BINUTILS_LINKER_LD
+    bool
+    prompt "ld"
+    help
+      The historical, bfd linker.
+
+config BINUTILS_LINKER_GOLD
+    bool
+    prompt "gold"
+    depends on BINUTILS_HAS_GOLD
+    depends on EXPERIMENTAL
+    select BINUTILS_GOLD_INSTALLED
+    help
+      gold is a new, optimised, multi-threaded linker with support
+      for plugins. Designed to be a drop-in replacement for the
+      original linker, ld, it can be much faster, with a 5:1 or
+      bigger ratio being not uncommon, YMMV.
+
+config BINUTILS_LINKER_LD_GOLD
+    bool
+    prompt "ld, gold"
+    depends on BINUTILS_HAS_GOLD
+    depends on EXPERIMENTAL
+    select BINUTILS_GOLD_INSTALLED
+    help
+      Both the historical ld and the new gold linkers will be
+      installed, with ld being the default linker used.
+      
+      See help for gold, above.
+
+config BINUTILS_LINKER_GOLD_LD
+    bool
+    prompt "gold, ld"
+    depends on BINUTILS_HAS_GOLD
+    depends on EXPERIMENTAL
+    select BINUTILS_GOLD_INSTALLED
+    help
+      Both the historical ld and the new gold linkers will be
+      installed, with gold being the default linker used.
+      
+      See help for gold, above.
+
+endchoice # Enable linkers
+
+config BINUTILS_GOLD_INSTALLED
+    bool
+
+config BINUTILS_LINKERS_LIST
+    string
+    default "ld"        if BINUTILS_LINKER_LD
+    default "gold"      if BINUTILS_LINKER_GOLD
+    default "ld,gold"   if BINUTILS_LINKER_LD_GOLD
+    default "gold,ld"   if BINUTILS_LINKER_GOLD_LD
+
+endif # BINUTILS_HAS_GOLD
 
 config BINUTILS_EXTRA_CONFIG
     string
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -26,6 +26,26 @@
     CT_DoStep INFO "Installing binutils"
 
     CT_DoLog EXTRA "Configuring binutils"
+
+    if [ "${CT_BINUTILS_HAS_GOLD}" = "y" ]; then
+        case "${CT_BINUTILS_LINKERS_LIST}" in
+            ld)
+                extra_config+=( --enable-ld=yes --enable-gold=no )
+                ;;
+            gold)
+                extra_config+=( --enable-ld=no --enable-gold=yes )
+                ;;
+            ld,gold)
+                extra_config+=( --enable-ld=default --enable-gold=yes )
+                ;;
+            gold,ld)
+                extra_config+=( --enable-ld=yes --enable-gold=default )
+                ;;
+        esac
+    fi
+
+    CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
+
     CFLAGS="${CT_CFLAGS_FOR_HOST}"                              \
     CT_DoExecLog CFG                                            \
     "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure"   \

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]