From 8e210c224193f065f6acc8a48e6d6affdccda42e Mon Sep 17 00:00:00 2001 From: Yuke Peng Date: Mon, 7 Oct 2024 12:54:38 +0800 Subject: [PATCH] Add ktest array to riscv64 linker --- osdk/src/base_crate/riscv64.ld.template | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osdk/src/base_crate/riscv64.ld.template b/osdk/src/base_crate/riscv64.ld.template index d701fd36b..a40f0e291 100644 --- a/osdk/src/base_crate/riscv64.ld.template +++ b/osdk/src/base_crate/riscv64.ld.template @@ -29,6 +29,14 @@ SECTIONS KEEP(*(.eh_frame .eh_frame.*)) } + # The list of unit test function symbols that should be executed while + # doing `cargo osdk test`. + .ktest_array : AT(ADDR(.ktest_array) - KERNEL_VMA_OFFSET) { + __ktest_array = .; + KEEP(*(SORT(.ktest_array))) + __ktest_array_end = .; + } + .init_array : AT(ADDR(.init_array) - KERNEL_VMA_OFFSET) { __sinit_array = .; KEEP(*(SORT(.init_array .init_array.*)))