[libc-commits] [libc] [libc] Enable bare-metal hermetic tests on Arm (PR #207361)

Volodymyr Turanskyy via libc-commits libc-commits at lists.llvm.org
Tue Jul 7 09:01:18 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))
+    *(.text .text.* .gnu.linkonce.t.*)
+    KEEP(*(.fini))
+
+    . = ALIGN(8);
+    PROVIDE_HIDDEN(__preinit_array_start = .);
+    KEEP(*(.preinit_array))
+    KEEP(*(.preinit_array.*))
+    PROVIDE_HIDDEN(__preinit_array_end = .);
----------------
voltur01 wrote:

Good suggestion, done.

https://github.com/llvm/llvm-project/pull/207361


More information about the libc-commits mailing list