mirror of
https://github.com/apache/nuttx.git
synced 2026-08-12 16:06:51 +00:00
ghs: fix the gnu-elf.ld handle error at pre-process
In Green Hills, if the name of the file to be preprocessed ends with ".ld", this file must be renamed to ".ld.i". Otherwise, the following error will be reported: ccarm: Error: -o out/build/cmake_out/mann_dcu_evb_ghs_ap/gnu-elf.ld has wrong suffix for -P option (expect .i) Currently, based on the documentation and actual operations, only files ending with "*.ld" can trigger this preprocessing error. There are no such issues in other cases. Signed-off-by: guoshichao <guoshichao@xiaomi.com>
This commit is contained in:
parent
1d8eab937f
commit
cda60ceab3
1 changed files with 21 additions and 2 deletions
|
|
@ -219,12 +219,31 @@ function(nuttx_generate_preprocess_target)
|
|||
ARGN
|
||||
${ARGN})
|
||||
|
||||
# in greenhills, for file to pre-process, if the file name is ends with
|
||||
# "*.ld", will report error, and we need to change the target file name to
|
||||
# "*.ld.i" or "*.ld.tmp", this is a special corner case, and the official
|
||||
# greenhills reference manual do not have explanation about why the only
|
||||
# "*.ld" should handle
|
||||
set(EXPECT_TARGET_FILE_NAME ${TARGET_FILE})
|
||||
string(REGEX MATCH ".*\.ld$" ends_with_ld ${TARGET_FILE})
|
||||
|
||||
if(ends_with_ld STREQUAL ${TARGET_FILE})
|
||||
set(EXPECT_TARGET_FILE_NAME "${TARGET_FILE}.i")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${TARGET_FILE}
|
||||
OUTPUT ${EXPECT_TARGET_FILE_NAME}
|
||||
COMMAND ${PREPROCESS} -I${CMAKE_BINARY_DIR}/include -filetype.cpp
|
||||
${SOURCE_FILE} -o ${TARGET_FILE}
|
||||
${SOURCE_FILE} -o ${EXPECT_TARGET_FILE_NAME}
|
||||
DEPENDS ${SOURCE_FILE} ${DEPENDS})
|
||||
|
||||
if(NOT ${EXPECT_TARGET_FILE_NAME} STREQUAL ${TARGET_FILE})
|
||||
add_custom_command(
|
||||
OUTPUT ${TARGET_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${EXPECT_TARGET_FILE_NAME} ${TARGET_FILE}
|
||||
DEPENDS ${EXPECT_TARGET_FILE_NAME})
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# override nuttx_find_toolchain_lib
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue