undefined reference to 'end' with nRF Connect SDK v2.4.0

Hello,

Earlier, we developed a library using nordic sdk v2.3.0 on nRF5340 TF-M secure environment. Now we planned to switch from nordic sdk v2.3.0 to v2.4.0.

While trying to compile our source code using nordic sdk v2.4.0, we observed the linker error (undefined reference to end) while calling the malloc() api but this error is not observed in nordic sdk v2.3.0.

Linker error:
c:/nordic/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:/nordic/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/lib/thumb/v8-m.main/nofp\libnosys.a(sbrk.o): in function `_sbrk':
sbrk.c:(.text._sbrk+0x1c): undefined reference to `end'
collect2.exe: error: ld returned 1 exit status

We could able to reproduce the same error with sample program (tfm_secure_peripheral). Here, we attached the compilation log and below is the code snippet for your reference. What are the changes we need to consider while compare between nordic sdk v2.4.0 and v2.3.0? Could you please point out if we missed anything? 


NOTE:
I observed the below CMake warning especially with nordic sdk v2.4.0.

CMake Warning at C:/nordic/v2.4.0/zephyr/CMakeLists.txt:838 (message):
No SOURCES given to Zephyr library: lib__libc__common

Excluding target from build.

Related