cmake:bugfix refine sim cmake redefine symbols

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
xuxin19 2024-04-15 20:07:35 +08:00 committed by Alan Carvalho de Assis
parent 242b50f921
commit f8437d52b7
2 changed files with 10 additions and 126 deletions

View File

@ -727,7 +727,7 @@ else()
${nuttx_libs_paths} ${nuttx_extra_libs}
$<$<NOT:$<BOOL:${APPLE}>>:-Wl,--end-group> -o nuttx.rel
COMMAND ${CMAKE_OBJCOPY} --redefine-syms=nuttx-names.dat nuttx.rel
DEPENDS ${nuttx_libs} ${nuttx_extra_libs} sim_head
DEPENDS ${nuttx_libs} ${nuttx_extra_libs} sim_head sim_redefine_symbols
COMMAND_EXPAND_LISTS)
endif()
add_custom_target(nuttx-rel DEPENDS nuttx.rel

View File

@ -18,129 +18,13 @@
#
# ##############################################################################
set(NXSYMBOLS
__cxa_atexit
abort
accept
access
atexit
backtrace
bind
calloc
chmod
chown
clock_gettime
close
closedir
connect
dlsym
dup
exit
fchmod
fchown
fclose
fcntl
fdopen
fopen
fprintf
fread
free
fseek
fstat
fsync
ftell
ftruncate
futimens
fwrite
getpeername
getsockname
getenv
getpid
getsockopt
if_nametoindex
ioctl
listen
longjmp
lseek
malloc
malloc_size
malloc_usable_size
memcpy
mkdir
mmap
mprotect
munmap
open
opendir
perror
poll
posix_memalign
pthread_attr_init
pthread_attr_setstack
pthread_attr_destroy
pthread_cond_destroy
pthread_cond_init
pthread_cond_signal
pthread_cond_wait
pthread_create
pthread_getspecific
pthread_key_create
pthread_kill
pthread_mutex_destroy
pthread_mutex_init
pthread_mutex_lock
pthread_mutex_unlock
pthread_setspecific
pthread_sigmask
puts
read
readdir
readv
realloc
recvfrom
rename
rewinddir
rmdir
sched_yield
select
sendmsg
sendto
setitimer
setbuf
setjmp
setsockopt
shutdown
sigaction
sigaddset
sigemptyset
sigfillset
sleep
socket
stat
statvfs
stderr
strcat
strchr
strerror
strlen
strtol
sysconf
syslog
tcgetattr
tcsetattr
unlink
usleep
utimensat
write
writev)
set(REDEFINE_INPUT_FILE ${NUTTX_DIR}/arch/sim/src/nuttx-names.in)
set(REDEFINE_OUTPUT_FILE ${CMAKE_BINARY_DIR}/nuttx-names.dat)
set(NXSYMBOL_RENAMES)
foreach(NXSYMBOL ${NXSYMBOLS})
if(APPLE OR (CYGWIN AND CONFIG_SIM_CYGWIN_DECORATED))
list(APPEND NXSYMBOL_RENAMES "_${NXSYMBOL} NX${NXSYMBOL}")
else()
list(APPEND NXSYMBOL_RENAMES "${NXSYMBOL} NX${NXSYMBOL}")
endif()
endforeach()
string(REPLACE ";" "\n" NXSYMBOL_RENAMES "${NXSYMBOL_RENAMES}")
file(WRITE ${CMAKE_BINARY_DIR}/nuttx-names.dat "${NXSYMBOL_RENAMES}\n")
add_custom_command(
OUTPUT ${REDEFINE_OUTPUT_FILE}
COMMAND ${CMAKE_C_COMPILER} -E -P -x c -I${CMAKE_BINARY_DIR}/include
${REDEFINE_INPUT_FILE} > ${REDEFINE_OUTPUT_FILE}
DEPENDS nuttx_context ${REDEFINE_INPUT_FILE})
add_custom_target(sim_redefine_symbols DEPENDS ${REDEFINE_OUTPUT_FILE})