Skip to content

Commit

Permalink
sim: add .scattered_array section inside .text section
Browse files Browse the repository at this point in the history
the ".scattered_array" section is required by optee_os,
optee_os will uniformly place all the functions that need to
be called during the system startup phase into the
`.scattered_array` section.
In order to enable optee_os to start up normally, we need to
addd this section to the linker script explicitly, otherwise the
function that put into `.scattered_array` section will be optimized
out during link procedure.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
  • Loading branch information
extinguish committed Dec 30, 2024
1 parent 9819517 commit 2ca5156
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/sim/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ ifneq ($(CONFIG_HOST_MACOS),y)
-e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld
$(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld
endif
ifeq ($(CONFIG_OPTEE_OS),y)
$(Q) sed -i 's/\*(.text.hot .text.hot.*)/KEEP(*(SORT(.scattered_array*)))\n *(.text.hot .text.hot.*)/g' nuttx.ld
endif
ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
$(Q) sed -i 's/\s*\.interp\s*:\s*{\s*\*(\.interp)\s*}/ \
.kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \
Expand Down

0 comments on commit 2ca5156

Please sign in to comment.