[libc-commits] [libc] Enable bare-metal hermetic tests on Arm (PR #207361)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Tue Jul 7 01:13:43 PDT 2026
================
@@ -0,0 +1,162 @@
+/*===----------------------------------------------------------------------===*
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===----------------------------------------------------------------------===*
+ *
+ * \file
+ * Bare-metal LLVM libc test linker script.
+ *
+ *===----------------------------------------------------------------------===*/
+
+ASSERT(DEFINED(__boot_flash), "__boot_flash must be defined");
+ASSERT(DEFINED(__boot_flash_size), "__boot_flash_size must be defined");
+ASSERT(DEFINED(__flash), "__flash must be defined");
+ASSERT(DEFINED(__flash_size), "__flash_size must be defined");
+ASSERT(DEFINED(__ram), "__ram must be defined");
+ASSERT(DEFINED(__ram_size), "__ram_size must be defined");
+
+MEMORY {
+ boot_flash (rx) : ORIGIN = __boot_flash, LENGTH = __boot_flash_size
+ flash (rx) : ORIGIN = __flash, LENGTH = __flash_size
+ ram (rwx) : ORIGIN = __ram, LENGTH = __ram_size
+}
+
+SECTIONS {
+ PROVIDE(__stack = ORIGIN(ram) + LENGTH(ram));
+
+ .boot_flash : {
+ KEEP(*(.text.init.enter))
+ KEEP(*(.vectors))
+ KEEP(*(.vectors.*))
+ KEEP(*(.data.init.enter))
+ KEEP(*(SORT_BY_NAME(.init) SORT_BY_NAME(.init.*)))
+ } > boot_flash
+
+ .text : ALIGN(8) {
+ KEEP(*(.text.startup .text.startup.*))
+ KEEP(*(.init))
----------------
petrhosek wrote:
LLVM libc is meant to be a modern libc implementation that only supports modern compilers, let's support just `.init_array`/`.fini_array` and omit `.init`/`.fini` and `.ctors`/`.dtors` support for simplicity.
https://github.com/llvm/llvm-project/pull/207361
More information about the libc-commits
mailing list