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

See crosstool-NG 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 2/5] libc/musl: Add options for optimization


This commit adds configuration knobs for optimizing musl-libc.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
---
 config/libc/musl.in.2      | 38 ++++++++++++++++++++++++++++++++++++++
 scripts/build/libc/musl.sh |  6 +++++-
 2 files changed, 43 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..32e9013
--- /dev/null
+++ b/config/libc/musl.in.2
@@ -0,0 +1,38 @@
+# 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 `--enable-optimize=no' to disable optimization.
+
+config LIBC_MUSL_OPTIMIZE_AUTO
+    bool
+    prompt "Use musl-libc's automatic optimization"
+    help
+      This option sets `--enable-optimize=auto' to automatically set optimization.
+
+config LIBC_MUSL_OPTIMIZE_SPEED
+    bool
+    prompt "Optimize musl-libc for speed"
+    help
+      This option sets `--enable-optimize=yes' to set optimization to -O3 for speed.
+
+config LIBC_MUSL_OPTIMIZE_SIZE
+    bool
+    prompt "Optimize musl-libc for size"
+    help
+      This option sets `--enable-optimize=size' to set optimization to -Os for size.
+
+endchoice
+
+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
diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh
index f997d25..d1aadfa 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_config
 
     # From buildroot:
     # gcc constant folding bug with weak aliases workaround
@@ -45,6 +46,8 @@ do_libc_configure() {
         extra_cflags+=("-fno-toplevel-reorder")
     fi
 
+    extra_config+=( "--enable-optimize=${CT_LIBC_MUSL_OPTIMIZE}" )
+
     # NOTE: musl handles the build/host/target a little bit differently
     # then one would expect:
     #   build   : not used
@@ -57,7 +60,8 @@ do_libc_configure() {
         --host="${CT_TARGET}"       \
         --target="${CT_TARGET}"     \
         --prefix="/usr"             \
-        --disable-gcc-wrapper
+        --disable-gcc-wrapper       \
+        "${extra_config[@]}"
 }
 
 do_libc_start_files() {
-- 
2.1.0


--
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]