From 581cfdf3cc37eced6e19e66c0d2daa6bd979ecdd Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Thu, 26 Oct 2023 15:06:14 +0200 Subject: [PATCH] lmdk: Enable linking with standard libraries Changed linker options to enable linking with libgcc and libc. This change is required to allow use compiler builtins functions (like __divdi3) and dynamic memory allocation functions. Signed-off-by: Adrian Warecki --- lmdk/cmake/build.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lmdk/cmake/build.cmake b/lmdk/cmake/build.cmake index e3182f596..0917a0b97 100644 --- a/lmdk/cmake/build.cmake +++ b/lmdk/cmake/build.cmake @@ -15,6 +15,9 @@ foreach(MODULE ${MODULES_LIST}) ### set_target_properties(${MODULE} PROPERTIES OUTPUT_NAME ${MODULE}.mod) + # uncomment line below to compile module with debug information + #target_compile_options(${MODULE} PUBLIC "-g3") + target_include_directories(${MODULE} PRIVATE "${LMDK_BASE}/include" "${RIMAGE_INCLUDE_DIR}" @@ -35,9 +38,9 @@ foreach(MODULE ${MODULES_LIST}) ) target_link_options(${MODULE} PRIVATE - "-nostdlib" "-nodefaultlibs" + "-nostartfiles" "-Wl,--no-undefined" "-Wl,--unresolved-symbols=report-all" "-Wl,--error-unresolved-symbols" - #"-Wl,--gc-sections" # may remove .bss and that will result in rimage error, do not use for now + "-Wl,--gc-sections" "-Wl,-Map,$.map" # optional: just for debug "-T" "${MODULE}_ldscripts/elf32xtensa.x" )