mirror of
https://github.com/apache/nuttx.git
synced 2026-03-24 07:22:46 +08:00
cmake(bugfix):fix sim loadable elf build support
1.add sanity check for START_OBJS 2.make laodable -e entry setting in each arch elf.cmake 3.add sim elf.cmake Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
This commit is contained in:
@@ -35,3 +35,5 @@ nuttx_elf_link_options_ifdef(CONFIG_BINFMT_ELF_RELOCATABLE -r)
|
||||
nuttx_elf_link_options_ifdef(CONFIG_BUILD_KERNEL -Bstatic)
|
||||
|
||||
nuttx_elf_link_options_ifdef(CONFIG_DEBUG_OPT_UNUSED_SECTIONS --gc-sections)
|
||||
|
||||
nuttx_elf_link_options(-e __start)
|
||||
|
||||
@@ -27,3 +27,5 @@ nuttx_elf_link_options_ifdef(CONFIG_BINFMT_ELF_RELOCATABLE -r)
|
||||
nuttx_elf_link_options_ifdef(CONFIG_BUILD_KERNEL -Bstatic)
|
||||
|
||||
nuttx_elf_link_options_ifdef(CONFIG_DEBUG_OPT_UNUSED_SECTIONS --gc-sections)
|
||||
|
||||
nuttx_elf_link_options(-e __start)
|
||||
|
||||
@@ -29,6 +29,12 @@ if(WIN32)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(CONFIG_HOST_LINUX)
|
||||
set(CMAKE_LD ld)
|
||||
set(CMAKE_PREPROCESSOR cc -E -P -x c)
|
||||
set(CMAKE_STRIP strip --strip-unneeded)
|
||||
endif()
|
||||
|
||||
# LLVM style architecture flags
|
||||
if(CONFIG_HOST_X86_64)
|
||||
if(CONFIG_SIM_M32)
|
||||
|
||||
29
arch/sim/src/cmake/elf.cmake
Normal file
29
arch/sim/src/cmake/elf.cmake
Normal file
@@ -0,0 +1,29 @@
|
||||
# ##############################################################################
|
||||
# arch/sim/src/cmake/elf.cmake
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||
# license agreements. See the NOTICE file distributed with this work for
|
||||
# additional information regarding copyright ownership. The ASF licenses this
|
||||
# file to you under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
# Loadable and ELF module settings
|
||||
|
||||
nuttx_elf_compile_options(-fvisibility=hidden -fno-pic)
|
||||
|
||||
nuttx_elf_compile_options_ifdef(CONFIG_LIBC_ARCH_ELF_64BIT -mcmodel=large)
|
||||
|
||||
nuttx_elf_link_options(-r -e main)
|
||||
|
||||
nuttx_elf_link_options_ifdef(CONFIG_SIM_M32 -melf_i386)
|
||||
@@ -25,3 +25,5 @@ nuttx_elf_compile_options(-fvisibility=hidden -fno-pic -mcmodel=large)
|
||||
nuttx_elf_link_options(-r)
|
||||
|
||||
nuttx_elf_link_options_ifdef(CONFIG_DEBUG_OPT_UNUSED_SECTIONS --gc-sections)
|
||||
|
||||
nuttx_elf_link_options(-e __start)
|
||||
|
||||
@@ -131,8 +131,9 @@ function(nuttx_add_application)
|
||||
COMMAND
|
||||
${CMAKE_LD}
|
||||
$<GENEX_EVAL:$<TARGET_PROPERTY:nuttx_global,NUTTX_ELF_APP_LINK_OPTIONS>>
|
||||
-e __start -T ${CMAKE_BINARY_DIR}/gnu-elf.ld
|
||||
$<TARGET_OBJECTS:STARTUP_OBJS> --start-group
|
||||
-T ${CMAKE_BINARY_DIR}/gnu-elf.ld
|
||||
$<$<TARGET_EXISTS:STARTUP_OBJS>:$<TARGET_OBJECTS:STARTUP_OBJS>>
|
||||
--start-group
|
||||
$<$<BOOL:${CONFIG_BUILD_KERNEL}>:$<GENEX_EVAL:$<TARGET_PROPERTY:nuttx_global,NUTTX_ELF_LINK_LIBRARIES>>>
|
||||
$<GENEX_EVAL:$<TARGET_PROPERTY:nuttx_global,NUTTX_ELF_LINK_EXTRA_LIBRARIES>>
|
||||
$<TARGET_FILE:${TARGET}> --end-group -o
|
||||
|
||||
Reference in New Issue
Block a user