build: fix syscall instrumentation in flat build

This fixes syscall instrumentation in flat build:

 - add syscall_names.c if LIB_SYSCALL=n to 'wraps'
   subdirectory

 - change execute_process to add_custom_command

 - fix typo in wrapper naming convention

Signed-off-by: Daniel Jasinski <jasinskidaniel95szcz@gmail.com>
This commit is contained in:
Daniel Jasinski 2024-08-20 12:35:21 -04:00 committed by Xiang Xiao
parent ea5bb64f42
commit 9798bc1d1f
2 changed files with 7 additions and 8 deletions

View File

@ -42,11 +42,9 @@ endif()
if(CONFIG_SCHED_INSTRUMENTATION_SYSCALL)
if(CONFIG_LIB_SYSCALL)
target_sources(proxies PRIVATE syscall_names.c)
target_sources(stubs PRIVATE syscall_names.c)
else()
target_sources(proxies PRIVATE syscall_names.c)
add_subdirectory(wraps)
target_sources(wraps PRIVATE syscall_names.c)
endif()
endif()
if(CONFIG_SCHED_INSTRUMENTATION_SYSCALL)
add_subdirectory(wraps)
endif()

View File

@ -19,14 +19,15 @@
# ##############################################################################
nuttx_add_kernel_library(wraps)
list(TRANSFORM SYSCALLS PREPEND "${CMAKE_CURRENT_BINARY_DIR}/WRAPS_")
list(TRANSFORM SYSCALLS PREPEND "${CMAKE_CURRENT_BINARY_DIR}/WRAP_")
# generate files
execute_process(
add_custom_command(
OUTPUT ${SYSCALLS}
COMMAND ${CMAKE_BINARY_DIR}/bin/mksyscall -w
${CMAKE_CURRENT_LIST_DIR}/../syscall.csv
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS nuttx_host_tools)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS mksyscall)
# TODO: SYSCALLWRAPS = syscall_wraps.ldcmd $(Q) $(CPP) $(CPPFLAGS)
# $(SYSCALLWRAPS:.ldcmd=.h) | \ sed -e '1,/WRAPOPTSTARTS/d' -e '/^#/d' >