[libc-commits] [libc] [libc] Reduce binary size for baremetal targets (PR #121164)

via libc-commits libc-commits at lists.llvm.org
Thu Dec 26 14:45:02 PST 2024


https://github.com/Prabhuk created https://github.com/llvm/llvm-project/pull/121164

For `math` functions we must choose size optimized implementations.
Removing framepointers will also help with binary size savings.


>From ac826de4abd6b2e73d1b79db6b3ffe307c8638f0 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Thu, 26 Dec 2024 14:42:29 -0800
Subject: [PATCH] [libc] Reduce binary size for baremetal targets

For `math` functions we must choose size optimized implementations.
Removing framepointers will also help with binary size savings.
---
 libc/config/baremetal/config.json | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libc/config/baremetal/config.json b/libc/config/baremetal/config.json
index dc4b0517d938df..85e80879d498e6 100644
--- a/libc/config/baremetal/config.json
+++ b/libc/config/baremetal/config.json
@@ -25,5 +25,15 @@
     "LIBC_CONF_QSORT_IMPL": {
       "value": "LIBC_QSORT_HEAP_SORT"
     }
+  },
+  "math": {
+    "LIBC_CONF_MATH_OPTIMIZATIONS": {
+      "value": "(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES)"
+    }
+  },
+  "codegen": {
+    "LIBC_CONF_KEEP_FRAME_POINTER": {
+      "value": false
+    }
   }
 }



More information about the libc-commits mailing list