xcc-clang: Do not used unavailable options

xcc-clang in based on clan-10 and does not support -fno-pic and
-fno-pie.

clang-10: warning: argument unused during compilation: '-fno-pic'
[-Wunused-command-line-argument]
[147/148] Linking C executable zephyr/zephyr.elf
clang-10: warning: argument unused during compilation: '-no-pie'
[-Wunused-command-line-argument]

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2022-08-22 08:47:03 -07:00 committed by Carles Cufí
parent 96e988c53a
commit 8259931fce
5 changed files with 21 additions and 2 deletions

View file

@ -353,13 +353,14 @@ zephyr_compile_options($<TARGET_PROPERTY:compiler,warning_extended>)
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,warning_error_implicit_int>>)
zephyr_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:compiler-cpp,warning_error_implicit_int>>)
# @Intent: Do not make position independent code / executable
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,no_position_independent>>)
# Allow the user to inject options when calling cmake, e.g.
# 'cmake -DEXTRA_CFLAGS="-Werror -Wno-deprecated-declarations" ..'
include(cmake/extra_flags.cmake)
zephyr_cc_option(-fno-asynchronous-unwind-tables)
zephyr_cc_option(-fno-pie)
zephyr_cc_option(-fno-pic)
if(CONFIG_THREAD_LOCAL_STORAGE)
# Only support local exec TLS model at this point.

View file

@ -175,6 +175,12 @@ set_property(TARGET compiler-cpp PROPERTY required "-Hcplus" "-Hoff=Stackcheck_a
# Compiler flag for turning off thread-safe initialization of local statics
set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe-statics")
#Compiler flags for disabling position independent code / executable
set_compiler_property(PROPERTY no_position_independent
-fno-pic
-fno-pie
)
#################################
# This section covers asm flags #
#################################

View file

@ -109,3 +109,6 @@ set_property(TARGET asm PROPERTY required)
# Compiler flag for disabling pointer arithmetic warnings
set_compiler_property(PROPERTY warning_no_pointer_arithmetic)
# Compiler flags for disabling position independent code / executable
set_compiler_property(PROPERTY no_position_independent)

View file

@ -192,3 +192,9 @@ endif()
# Compiler flag for disabling pointer arithmetic warnings
set_compiler_property(PROPERTY warning_no_pointer_arithmetic "-Wno-pointer-arith")
#Compiler flags for disabling position independent code / executable
set_compiler_property(PROPERTY no_position_independent
-fno-pic
-fno-pie
)

View file

@ -12,3 +12,6 @@ if($ENV{XCC_NO_G_FLAG})
# Clear the related flag(s) here so it won't cause issues.
set_compiler_property(PROPERTY debug)
endif()
# Clang version used by Xtensa does not support -fno-pic and -fno-pie
set_compiler_property(PROPERTY no_position_independent "")