Skip to content

Commit

Permalink
xcc-clang: Do not used unavailable options
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Flavio Ceolin authored and carlescufi committed Aug 23, 2022
1 parent 96e988c commit 8259931
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions cmake/compiler/arcmwdt/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
#################################
Expand Down
3 changes: 3 additions & 0 deletions cmake/compiler/compiler_flags_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 6 additions & 0 deletions cmake/compiler/gcc/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
3 changes: 3 additions & 0 deletions cmake/compiler/xcc-clang/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "")

0 comments on commit 8259931

Please sign in to comment.