Message ID | 1409864217-17035-2-git-send-email-bryanhundven@gmail.com |
---|---|
State | Superseded |
Headers | show |
Bryan, All, On 2014-09-04 13:56 -0700, Bryan Hundven spake thusly: > This commit adds configuration knobs for optimizing musl-libc. > > Signed-off-by: Bryan Hundven <bryanhundven@gmail.com> > --- > config/libc/musl.in.2 | 32 ++++++++++++++++++++++++++++++++ > scripts/build/libc/musl.sh | 14 +++++++++++++- > 2 files changed, 45 insertions(+), 1 deletion(-) > create mode 100644 config/libc/musl.in.2 > > diff --git a/config/libc/musl.in.2 b/config/libc/musl.in.2 > new file mode 100644 > index 0000000..42f45e1 > --- /dev/null > +++ b/config/libc/musl.in.2 > @@ -0,0 +1,32 @@ > +# musl second-part option > + > +choice > + prompt "How to optimize musl-libc" > + default LIBC_MUSL_OPTIMIZE_AUTO > + > +config LIBC_MUSL_OPTIMIZE_NONE > + bool > + prompt "Do not optimize musl-libc" > + help > + This option sets `--optimize=no' > + > +config LIBC_MUSL_OPTIMIZE_AUTO > + bool > + prompt "Optimize musl-libc based CFLAGS passed" Wrong prompt (as already seen on IRC). > + help > + This option allows musl-libc's ./configure script to automatically > + set the optimization. > + > +config LIBC_MUSL_OPTIMIZE_SPEED > + bool > + prompt "Optimize musl-libc for speed" > + help > + This option sets `--optimize=yes' "Speed" vs. "yes" <-- correct? > +config LIBC_MUSL_OPTIMIZE_SIZE > + bool > + prompt "Optimize musl-libc for size" > + help > + This option sets `--optimize=size' > + > +endchoice What about adding: config LIBC_MUSL_OPTIMIZE string default "no" if LIBC_MUSL_OPTIMIZE_NONE default "auto" if LIBC_MUSL_OPTIMIZE_AUTO default "yes" if LIBC_MUSL_OPTIMIZE_SPEED default "size" if LIBC_MUSL_OPTIMIZE_SIZE And then... [1] > diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh > index 6dbf657..bd7ae2a 100644 > --- a/scripts/build/libc/musl.sh > +++ b/scripts/build/libc/musl.sh > @@ -37,6 +37,7 @@ do_libc_check_config() { > do_libc_configure() { > CT_DoLog EXTRA "Configuring C library" > local -a extra_cflags > + local -a extra_conf extra_config [0] > # From buildroot: > # gcc constant folding bug with weak aliases workaround > @@ -45,6 +46,16 @@ do_libc_configure() { > extra_cflags+=("-fno-toplevel-reorder") > fi > > + if [ "${CT_LIBC_MUSL_OPTIMIZE_NONE}" = "y" ]; then > + extra_conf+=("--optimize=no") > + elif [ "${CT_LIBC_MUSL_OPTIMIZE_AUTO}" = "y" ]; then > + extra_conf+=("--optimize=auto") > + elif [ "${CT_LIBC_MUSL_OPTIMIZE_SPEED}" = "y" ]; then > + extra_conf+=("--optimize=yes") > + elif [ "${CT_LIBC_MUSL_OPTIMIZE_SIZE}" = "y" ]; then > + extra_conf+=("--optimize=size") > + fi [1] use it here instead of all the if-else blocks: extra_config+=( "--optimize=${CT_LIBC_MUSL_OPTIMIZE}" ) > # NOTE: musl handles the build/host/target a little bit differently > # then one would expect: > # build : not used > @@ -56,7 +67,8 @@ do_libc_configure() { > ./configure \ > --host="${CT_TARGET}" \ > --target="${CT_TARGET}" \ > - --prefix="/usr" > + --prefix="/usr" \ > + "${extra_config[@]}" [0] Because that's what you're using here (and we are using everywhere else, too.) Regards, Yann E. MORIN. > } > > do_libc_start_files() { > -- > 2.1.0 >
diff --git a/config/libc/musl.in.2 b/config/libc/musl.in.2 new file mode 100644 index 0000000..42f45e1 --- /dev/null +++ b/config/libc/musl.in.2 @@ -0,0 +1,32 @@ +# musl second-part option + +choice + prompt "How to optimize musl-libc" + default LIBC_MUSL_OPTIMIZE_AUTO + +config LIBC_MUSL_OPTIMIZE_NONE + bool + prompt "Do not optimize musl-libc" + help + This option sets `--optimize=no' + +config LIBC_MUSL_OPTIMIZE_AUTO + bool + prompt "Optimize musl-libc based CFLAGS passed" + help + This option allows musl-libc's ./configure script to automatically + set the optimization. + +config LIBC_MUSL_OPTIMIZE_SPEED + bool + prompt "Optimize musl-libc for speed" + help + This option sets `--optimize=yes' + +config LIBC_MUSL_OPTIMIZE_SIZE + bool + prompt "Optimize musl-libc for size" + help + This option sets `--optimize=size' + +endchoice diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh index 6dbf657..bd7ae2a 100644 --- a/scripts/build/libc/musl.sh +++ b/scripts/build/libc/musl.sh @@ -37,6 +37,7 @@ do_libc_check_config() { do_libc_configure() { CT_DoLog EXTRA "Configuring C library" local -a extra_cflags + local -a extra_conf # From buildroot: # gcc constant folding bug with weak aliases workaround @@ -45,6 +46,16 @@ do_libc_configure() { extra_cflags+=("-fno-toplevel-reorder") fi + if [ "${CT_LIBC_MUSL_OPTIMIZE_NONE}" = "y" ]; then + extra_conf+=("--optimize=no") + elif [ "${CT_LIBC_MUSL_OPTIMIZE_AUTO}" = "y" ]; then + extra_conf+=("--optimize=auto") + elif [ "${CT_LIBC_MUSL_OPTIMIZE_SPEED}" = "y" ]; then + extra_conf+=("--optimize=yes") + elif [ "${CT_LIBC_MUSL_OPTIMIZE_SIZE}" = "y" ]; then + extra_conf+=("--optimize=size") + fi + # NOTE: musl handles the build/host/target a little bit differently # then one would expect: # build : not used @@ -56,7 +67,8 @@ do_libc_configure() { ./configure \ --host="${CT_TARGET}" \ --target="${CT_TARGET}" \ - --prefix="/usr" + --prefix="/usr" \ + "${extra_config[@]}" } do_libc_start_files() {
This commit adds configuration knobs for optimizing musl-libc. Signed-off-by: Bryan Hundven <bryanhundven@gmail.com> --- config/libc/musl.in.2 | 32 ++++++++++++++++++++++++++++++++ scripts/build/libc/musl.sh | 14 +++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 config/libc/musl.in.2