[libc-commits] [libc] [libc][uefi] Tune the libc configuration for UEFI (PR #239334)
Prabhu Rajasekaran via libc-commits
libc-commits at lists.llvm.org
Thu Nov 5 14:03:59 PST 2026
https://github.com/Prabhuk updated https://github.com/llvm/llvm-project/pull/239334
>From bfd15ff92439972dd8241b4f69963ce47fb56bf2 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Thu, 5 Nov 2026 18:32:29 +0000
Subject: [PATCH 1/2] [libc][uefi] Tune the libc configuration for UEFI
Configure UEFI as a single threaded freestanding target and leave out the
printf, scanf and qsort features that firmware applications do not need,
so that the library stays small. Disable the strong stack protector until
a runtime provides the stack guard for UEFI images. Floating point
formatting stays enabled, since both supported UEFI architectures have
hardware floating point.
Assisted-by: Claude
---
libc/config/uefi/config.json | 48 ++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/libc/config/uefi/config.json b/libc/config/uefi/config.json
index 51aa8fecf8b307..708593dbf0fb90 100644
--- a/libc/config/uefi/config.json
+++ b/libc/config/uefi/config.json
@@ -3,5 +3,53 @@
"LIBC_CONF_ERRNO_MODE": {
"value": "LIBC_ERRNO_MODE_SHARED"
}
+ },
+ "threads": {
+ "LIBC_CONF_THREAD_MODE": {
+ "value": "LIBC_THREAD_MODE_SINGLE"
+ }
+ },
+ "printf": {
+ "LIBC_CONF_PRINTF_DISABLE_FIXED_POINT": {
+ "value": true
+ },
+ "LIBC_CONF_PRINTF_DISABLE_INDEX_MODE": {
+ "value": true
+ },
+ "LIBC_CONF_PRINTF_DISABLE_WRITE_INT": {
+ "value": true
+ },
+ "LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE": {
+ "value": false
+ },
+ "LIBC_CONF_PRINTF_DISABLE_STRERROR": {
+ "value": true
+ },
+ "LIBC_CONF_PRINTF_DISABLE_WIDE": {
+ "value": true
+ },
+ "LIBC_COPT_PRINTF_DISABLE_BITINT": {
+ "value": true
+ }
+ },
+ "scanf": {
+ "LIBC_CONF_SCANF_DISABLE_INDEX_MODE": {
+ "value": true
+ }
+ },
+ "qsort": {
+ "LIBC_CONF_QSORT_IMPL": {
+ "value": "LIBC_QSORT_HEAP_SORT"
+ }
+ },
+ "codegen": {
+ "LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR": {
+ "value": false
+ }
+ },
+ "ctype": {
+ "LIBC_CONF_CTYPE_SMALLER_ASCII": {
+ "value": true
+ }
}
}
>From 4435012879fe58305f71951bc7e8eb1f881c5e60 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Thu, 5 Nov 2026 22:02:52 +0000
Subject: [PATCH 2/2] [libc][uefi] Drop a config option that matches the
default
Remove the long double table setting from the UEFI configuration, since
it repeats the default value.
Assisted-by: Claude
---
libc/config/uefi/config.json | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libc/config/uefi/config.json b/libc/config/uefi/config.json
index 708593dbf0fb90..876f8c0d562b11 100644
--- a/libc/config/uefi/config.json
+++ b/libc/config/uefi/config.json
@@ -19,9 +19,6 @@
"LIBC_CONF_PRINTF_DISABLE_WRITE_INT": {
"value": true
},
- "LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE": {
- "value": false
- },
"LIBC_CONF_PRINTF_DISABLE_STRERROR": {
"value": true
},
More information about the libc-commits
mailing list