libc/eglibc: Add option to optimize for size
authorRichard Strand <richard.strand@icomera.com>
Mon Feb 01 12:56:28 2010 +0000 (2010-02-01)
changeset 1796f1dc942a12c2
parent 1791 160fc94ed49f
child 1797 42c618ca576e
libc/eglibc: Add option to optimize for size

Add an option to eglibc to optimize for size using -Os.

Signed-off-by: Richard Strand <richard.strand@icomera.com>
config/libc/eglibc.in
scripts/build/libc/eglibc.sh
     1.1 --- a/config/libc/eglibc.in	Sun Jan 31 23:04:35 2010 +0100
     1.2 +++ b/config/libc/eglibc.in	Mon Feb 01 12:56:28 2010 +0000
     1.3 @@ -95,6 +95,13 @@
     1.4        Note that crosstool-NG will *not* update your working copy, you will
     1.5        have to do that yourself.
     1.6  
     1.7 +config EGLIBC_OPT_SIZE
     1.8 +    bool
     1.9 +    prompt "optimize eglibc for size (-Os)"
    1.10 +    help
    1.11 +      Optimize eglibc for size using -Os instead of -O2. This will make eglibc
    1.12 +      smaller but may make it slower.
    1.13 +
    1.14  config EGLIBC_CUSTOM_CONFIG
    1.15      bool
    1.16      prompt "Use custom configuration file"
     2.1 --- a/scripts/build/libc/eglibc.sh	Sun Jan 31 23:04:35 2010 +0100
     2.2 +++ b/scripts/build/libc/eglibc.sh	Mon Feb 01 12:56:28 2010 +0000
     2.3 @@ -259,6 +259,12 @@
     2.4          CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/eglibc.config" option-groups.config
     2.5      fi
     2.6  
     2.7 +    if [ "${CT_EGLIBC_OPT_SIZE}" = "y" ]; then
     2.8 +        OPTIMIZE=-Os
     2.9 +    else
    2.10 +        OPTIMIZE=-O2
    2.11 +    fi
    2.12 +
    2.13      # Add some default glibc config options if not given by user.
    2.14      # We don't need to be conditional on wether the user did set different
    2.15      # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
    2.16 @@ -301,7 +307,7 @@
    2.17      CT_DoLog DEBUG "Extra CC args passed    : '${extra_cc_args}'"
    2.18  
    2.19      BUILD_CC="${CT_BUILD}-gcc"                                      \
    2.20 -    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} -O2"  \
    2.21 +    CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_GLIBC_EXTRA_CFLAGS} ${OPTIMIZE}"  \
    2.22      CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
    2.23      AR=${CT_TARGET}-ar                                              \
    2.24      RANLIB=${CT_TARGET}-ranlib                                      \