diff --git a/arch/x86_64/src/cmake/elf.cmake b/arch/x86_64/src/cmake/elf.cmake new file mode 100644 index 00000000000..1bcbc42a88b --- /dev/null +++ b/arch/x86_64/src/cmake/elf.cmake @@ -0,0 +1,27 @@ +# ############################################################################## +# arch/x86_64/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 -mcmodel=large) + +nuttx_elf_link_options(-r) + +nuttx_elf_link_options_ifdef(CONFIG_DEBUG_OPT_UNUSED_SECTIONS --gc-sections) diff --git a/arch/x86_64/src/common/CMakeLists.txt b/arch/x86_64/src/common/CMakeLists.txt index b71072fbefa..841fa136799 100644 --- a/arch/x86_64/src/common/CMakeLists.txt +++ b/arch/x86_64/src/common/CMakeLists.txt @@ -79,3 +79,10 @@ if(CONFIG_ARCH_HAVE_DEBUG) endif() target_sources(arch PRIVATE ${SRCS}) + +nuttx_add_aux_library(STARTUP_OBJS crt0.c) + +target_compile_options( + STARTUP_OBJS + PRIVATE + $>)