From 47727c02df4c79c21c6ceffaff65222c32cf6996 Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Tue, 12 Feb 2019 13:35:08 +0100 Subject: Add -fno-common compile option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -fno-common makes sure we do not have multiple declarations of the same global symbol across compilation units. It helps debug nasty linkage bugs by guaranteeing that all reference to a global symbol use the same underlying object. It also helps avoiding benign mistakes such as declaring enum as global objects instead of types in headers (hence the minor fixes scattered across the source). Change-Id: I55c16406dc54ff8a6860238b90ca990fa6b179f1 Signed-off-by: Benoît Ganne --- src/cmake/cpu.cmake | 2 +- src/cmake/library.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cmake') diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake index b2af1aa0926..60cf3b9dcf0 100644 --- a/src/cmake/cpu.cmake +++ b/src/cmake/cpu.cmake @@ -93,7 +93,7 @@ macro(vpp_library_set_multiarch_sources lib) set(l ${lib}_${VARIANT}) add_library(${l} OBJECT ${ARGN}) set_target_properties(${l} PROPERTIES POSITION_INDEPENDENT_CODE ON) - target_compile_options(${l} PUBLIC "-DCLIB_MARCH_VARIANT=${VARIANT}") + target_compile_options(${l} PUBLIC "-DCLIB_MARCH_VARIANT=${VARIANT}" -Wall -fno-common) separate_arguments(VARIANT_FLAGS) target_compile_options(${l} PUBLIC ${VARIANT_FLAGS}) target_sources(${lib} PRIVATE $) diff --git a/src/cmake/library.cmake b/src/cmake/library.cmake index 984d6eb8d75..747aeb4705f 100644 --- a/src/cmake/library.cmake +++ b/src/cmake/library.cmake @@ -20,7 +20,7 @@ macro(add_vpp_library lib) ) add_library(${lib} SHARED ${ARG_SOURCES}) - target_compile_options(${lib} PRIVATE -Wall) + target_compile_options(${lib} PRIVATE -Wall -fno-common) if(VPP_LIB_VERSION) set_target_properties(${lib} PROPERTIES SOVERSION ${VPP_LIB_VERSION}) endif() -- cgit 1.2.3-korg