[libc-commits] [libc] [LIBC][ARM] Enable MMU setup and alignment fault handling during startup. (PR #204803)
via libc-commits
libc-commits at lists.llvm.org
Fri Jun 19 04:52:31 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- libc/startup/baremetal/aarch64/start.cpp libc/startup/baremetal/arm/start.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/startup/baremetal/aarch64/start.cpp b/libc/startup/baremetal/aarch64/start.cpp
index fbd565114..1d35638d2 100644
--- a/libc/startup/baremetal/aarch64/start.cpp
+++ b/libc/startup/baremetal/aarch64/start.cpp
@@ -41,7 +41,8 @@ constexpr uint64_t PAGE_TABLE_ALIGNMENT = 4096;
// Put the page table in a no-init section so it doesn't later get
// zero-initialized.
-[[gnu::section(".noinit.page_table"), gnu::aligned(PAGE_TABLE_ALIGNMENT), gnu::used]]
+[[gnu::section(".noinit.page_table"), gnu::aligned(PAGE_TABLE_ALIGNMENT),
+ gnu::used]]
volatile uint64_t page_table[PAGE_TABLE_ENTRY_COUNT];
uintptr_t get_stackheap_start() {
diff --git a/libc/startup/baremetal/arm/start.cpp b/libc/startup/baremetal/arm/start.cpp
index 1caff934d..20a865200 100644
--- a/libc/startup/baremetal/arm/start.cpp
+++ b/libc/startup/baremetal/arm/start.cpp
@@ -35,14 +35,14 @@ extern uintptr_t __bss_size[];
} // extern "C"
namespace {
-#if __ARM_ARCH_PROFILE == 'A' && !defined(__ARM_ARCH_ISA_A64) && \
- __ARM_ARCH >= 7
+#if __ARM_ARCH_PROFILE == 'A' && !defined(__ARM_ARCH_ISA_A64) && __ARM_ARCH >= 7
constexpr uint32_t PAGE_TABLE_ENTRY_COUNT = 4096;
constexpr uint32_t PAGE_TABLE_ALIGNMENT = 16384;
// Put the page table in a no-init section so it doesn't later get
// zero-initialized.
-[[gnu::section(".noinit.page_table"), gnu::aligned(PAGE_TABLE_ALIGNMENT), gnu::used]]
+[[gnu::section(".noinit.page_table"), gnu::aligned(PAGE_TABLE_ALIGNMENT),
+ gnu::used]]
volatile uint32_t page_table[PAGE_TABLE_ENTRY_COUNT];
void setup_mmu() {
@@ -188,8 +188,7 @@ namespace LIBC_NAMESPACE_DECL {
__arm_wsr("CPSR_c", 0x13); // SVC
#endif
-#if __ARM_ARCH_PROFILE == 'A' && !defined(__ARM_ARCH_ISA_A64) && \
- __ARM_ARCH >= 7
+#if __ARM_ARCH_PROFILE == 'A' && !defined(__ARM_ARCH_ISA_A64) && __ARM_ARCH >= 7
__arm_wsr("p15:0:c12:c0:0", reinterpret_cast<uint32_t>(&vector_table));
setup_mmu();
#endif
``````````
</details>
https://github.com/llvm/llvm-project/pull/204803
More information about the libc-commits
mailing list