binutils/binutils: add option to enable gold
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Dec 28 00:11:33 2010 +0100 (2010-12-28)
changeset 2244dc2d2342e4a9
parent 2243 1fb02a4ca444
child 2245 a6d790bc17af
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>
config/binutils/binutils.in
scripts/build/binutils/binutils.sh
     1.1 --- a/config/binutils/binutils.in	Tue Dec 28 19:07:21 2010 +0100
     1.2 +++ b/config/binutils/binutils.in	Tue Dec 28 00:11:33 2010 +0100
     1.3 @@ -61,6 +61,72 @@
     1.4  
     1.5  config BINUTILS_2_21_or_later
     1.6      bool
     1.7 +    select BINUTILS_HAS_GOLD
     1.8 +
     1.9 +config BINUTILS_HAS_GOLD
    1.10 +    bool
    1.11 +
    1.12 +if BINUTILS_HAS_GOLD
    1.13 +
    1.14 +choice
    1.15 +    bool
    1.16 +    prompt "Linkers to enable"
    1.17 +
    1.18 +config BINUTILS_LINKER_LD
    1.19 +    bool
    1.20 +    prompt "ld"
    1.21 +    help
    1.22 +      The historical, bfd linker.
    1.23 +
    1.24 +config BINUTILS_LINKER_GOLD
    1.25 +    bool
    1.26 +    prompt "gold"
    1.27 +    depends on BINUTILS_HAS_GOLD
    1.28 +    depends on EXPERIMENTAL
    1.29 +    select BINUTILS_GOLD_INSTALLED
    1.30 +    help
    1.31 +      gold is a new, optimised, multi-threaded linker with support
    1.32 +      for plugins. Designed to be a drop-in replacement for the
    1.33 +      original linker, ld, it can be much faster, with a 5:1 or
    1.34 +      bigger ratio being not uncommon, YMMV.
    1.35 +
    1.36 +config BINUTILS_LINKER_LD_GOLD
    1.37 +    bool
    1.38 +    prompt "ld, gold"
    1.39 +    depends on BINUTILS_HAS_GOLD
    1.40 +    depends on EXPERIMENTAL
    1.41 +    select BINUTILS_GOLD_INSTALLED
    1.42 +    help
    1.43 +      Both the historical ld and the new gold linkers will be
    1.44 +      installed, with ld being the default linker used.
    1.45 +      
    1.46 +      See help for gold, above.
    1.47 +
    1.48 +config BINUTILS_LINKER_GOLD_LD
    1.49 +    bool
    1.50 +    prompt "gold, ld"
    1.51 +    depends on BINUTILS_HAS_GOLD
    1.52 +    depends on EXPERIMENTAL
    1.53 +    select BINUTILS_GOLD_INSTALLED
    1.54 +    help
    1.55 +      Both the historical ld and the new gold linkers will be
    1.56 +      installed, with gold being the default linker used.
    1.57 +      
    1.58 +      See help for gold, above.
    1.59 +
    1.60 +endchoice # Enable linkers
    1.61 +
    1.62 +config BINUTILS_GOLD_INSTALLED
    1.63 +    bool
    1.64 +
    1.65 +config BINUTILS_LINKERS_LIST
    1.66 +    string
    1.67 +    default "ld"        if BINUTILS_LINKER_LD
    1.68 +    default "gold"      if BINUTILS_LINKER_GOLD
    1.69 +    default "ld,gold"   if BINUTILS_LINKER_LD_GOLD
    1.70 +    default "gold,ld"   if BINUTILS_LINKER_GOLD_LD
    1.71 +
    1.72 +endif # BINUTILS_HAS_GOLD
    1.73  
    1.74  config BINUTILS_EXTRA_CONFIG
    1.75      string
     2.1 --- a/scripts/build/binutils/binutils.sh	Tue Dec 28 19:07:21 2010 +0100
     2.2 +++ b/scripts/build/binutils/binutils.sh	Tue Dec 28 00:11:33 2010 +0100
     2.3 @@ -26,6 +26,26 @@
     2.4      CT_DoStep INFO "Installing binutils"
     2.5  
     2.6      CT_DoLog EXTRA "Configuring binutils"
     2.7 +
     2.8 +    if [ "${CT_BINUTILS_HAS_GOLD}" = "y" ]; then
     2.9 +        case "${CT_BINUTILS_LINKERS_LIST}" in
    2.10 +            ld)
    2.11 +                extra_config+=( --enable-ld=yes --enable-gold=no )
    2.12 +                ;;
    2.13 +            gold)
    2.14 +                extra_config+=( --enable-ld=no --enable-gold=yes )
    2.15 +                ;;
    2.16 +            ld,gold)
    2.17 +                extra_config+=( --enable-ld=default --enable-gold=yes )
    2.18 +                ;;
    2.19 +            gold,ld)
    2.20 +                extra_config+=( --enable-ld=yes --enable-gold=default )
    2.21 +                ;;
    2.22 +        esac
    2.23 +    fi
    2.24 +
    2.25 +    CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
    2.26 +
    2.27      CFLAGS="${CT_CFLAGS_FOR_HOST}"                              \
    2.28      CT_DoExecLog CFG                                            \
    2.29      "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure"   \