Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion cmake/init-compilation-flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if(APPLE)
add_definitions(-D_XOPEN_SOURCE)
else()
# Since Ubuntu 22.04 lto is enabled by default; breaks some builds
add_link_options(-fno-lto)
#add_link_options(-fno-lto)
endif()


Expand Down Expand Up @@ -65,6 +65,20 @@ endif()
cmake_print_variables(CMAKE_BUILD_TYPE)
if("${CMAKE_BUILD_TYPE}" STREQUAL ${DEFAULT_BUILD_TYPE})
add_compile_options(-O3)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION 1)
if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
set(COMPILE_LTO_OPTIONS -flto)
set(LINK_LTO_OPTIONS -flto)
if(NOT APPLE)
list(APPEND COMPILE_LTO_OPTIONS -ffat-lto-objects)
endif()
if(COMPILER_GCC)
list(APPEND COMPILE_LTO_OPTIONS -Wl,-flto)
endif()
add_compile_options(${COMPILE_LTO_OPTIONS})
add_link_options(${LINK_LTO_OPTIONS})
list(JOIN COMPILE_LTO_OPTIONS " " THIRD_PARTY_LTO_OPTIONS)
endif()
endif()

if(DEFINED ENV{FAST_COMPILATION_FMT})
Expand Down
8 changes: 7 additions & 1 deletion cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ endfunction()

function(allow_deprecated_declarations)
foreach(src_file ${ARGN})
set_source_files_properties(${src_file} PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations)
set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-deprecated-declarations)
endforeach()
endfunction()

function(allow_stringop_overflow)
foreach(src_file ${ARGN})
set_property(SOURCE ${src_file} APPEND PROPERTY COMPILE_OPTIONS -Wno-stringop-overflow)
endforeach()
endfunction()

Expand Down
2 changes: 1 addition & 1 deletion compiler/compiler-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void CompilerSettings::init() {
std::string cxx_default_flags = ss.str();

cxx_toolchain_option.value_ = !cxx_toolchain_dir.value_.empty() ? ("-B" + cxx_toolchain_dir.value_) : "";
incremental_linker_flags.value_ = dynamic_incremental_linkage.get() ? "-shared" : "-r -nostdlib";
incremental_linker_flags.value_ = dynamic_incremental_linkage.get() ? "-shared" : "-r -nostdlib -gdwarf64 -gdwarf-5 -mcmodel=large -flto -Wl,-flto -flinker-output=rel";

remove_extra_spaces(extra_ld_flags.value_);

Expand Down
33 changes: 30 additions & 3 deletions compiler/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,36 @@ prepend(KPHP_COMPILER_SOURCES ${KPHP_COMPILER_DIR}/
utils/string-utils.cpp)

# Suppress YAML-cpp-related warnings
if(COMPILER_CLANG)
allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/composer-json-data.cpp)
allow_deprecated_declarations(${KPHP_COMPILER_DIR}/data/modulite-data.cpp)
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(
${KPHP_COMPILER_DIR}/data/composer-json-data.cpp
${KPHP_COMPILER_DIR}/data/modulite-data.cpp
)
endif()

if(COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0"))
allow_stringop_overflow(
${KPHP_COMPILER_DIR}/code-gen/vertex-compiler.cpp
${KPHP_COMPILER_DIR}/data/class-data.cpp
${KPHP_COMPILER_DIR}/data/kphp-json-tags.cpp
${KPHP_COMPILER_DIR}/data/generics-mixins.cpp
${KPHP_COMPILER_DIR}/data/kphp-tracing-tags.cpp
${KPHP_COMPILER_DIR}/data/modulite-data.cpp
${KPHP_COMPILER_DIR}/code-gen/files/tracing-autogen.cpp
${KPHP_COMPILER_DIR}/pipes/analyze-performance.cpp
${KPHP_COMPILER_DIR}/pipes/check-access-modifiers.cpp
${KPHP_COMPILER_DIR}/pipes/check-classes.cpp
${KPHP_COMPILER_DIR}/pipes/check-tl-classes.cpp
${KPHP_COMPILER_DIR}/pipes/code-gen.cpp
${KPHP_COMPILER_DIR}/pipes/filter-only-actually-used.cpp
${KPHP_COMPILER_DIR}/pipes/final-check.cpp
${KPHP_COMPILER_DIR}/pipes/parse-and-apply-phpdoc.cpp
${KPHP_COMPILER_DIR}/pipes/sort-and-inherit-classes.cpp
${KPHP_COMPILER_DIR}/pipes/register-kphp-configuration.cpp
${KPHP_COMPILER_DIR}/phpdoc.cpp
${KPHP_COMPILER_DIR}/gentree.cpp
${KPHP_COMPILER_DIR}/make/make.cpp
)
endif()

if(APPLE)
Expand Down
3 changes: 2 additions & 1 deletion compiler/ffi/c_parser/parsing_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <charconv>
#include <unordered_set>
#include <vector>

using namespace ffi;

Expand Down Expand Up @@ -113,7 +114,7 @@ FFIType *ParsingDriver::function_to_var(FFIType *function) {
function->kind = FFITypeKind::Var;
FFIType *function_ptr_type = alloc.new_type(FFITypeKind::FunctionPointer);
function_ptr_type->members = std::move(function->members);
function->members = {function_ptr_type};
function->members = std::vector<FFIType*>{function_ptr_type};
return function;
}

Expand Down
24 changes: 16 additions & 8 deletions runtime-common/core/core-types/definition/array.inl
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,22 @@ template<>
inline typename array<Unknown>::array_inner* array<Unknown>::array_inner::empty_array() {
// need this hack because gcc10 and newer complains about
// "array subscript is outside array bounds of array<Unknown>::array_inner"
static array_inner_control empty_array[1]{{
true,
ExtraRefCnt::for_global_const,
-1,
{0, 0},
0,
2,
}};
static array_inner_control empty_array[2]{{
true,
ExtraRefCnt::for_global_const,
-1,
{0, 0},
0,
2,
},
{
true,
ExtraRefCnt::for_global_const,
-1,
{0, 0},
0,
2,
}};
return static_cast<array<Unknown>::array_inner*>(&empty_array[0]);
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ set_source_files_properties(
)

# Suppress YAML-cpp-related warnings
if(COMPILER_CLANG)
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(${BASE_DIR}/runtime/interface.cpp)
endif()

Expand Down
14 changes: 8 additions & 6 deletions server/server.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ prepend(KPHP_SERVER_SOURCES ${BASE_DIR}/server/
signal-handlers.cpp)

# Suppress YAML-cpp-related warnings
if(COMPILER_CLANG)
allow_deprecated_declarations(${BASE_DIR}/server/json-logger.cpp)
allow_deprecated_declarations(${BASE_DIR}/server/lease-config-parser.cpp)
allow_deprecated_declarations(${BASE_DIR}/server/php-engine.cpp)
allow_deprecated_declarations(${BASE_DIR}/server/php-master.cpp)
allow_deprecated_declarations(${BASE_DIR}/server/server-config.cpp)
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(
${BASE_DIR}/server/json-logger.cpp
${BASE_DIR}/server/lease-config-parser.cpp
${BASE_DIR}/server/php-engine.cpp
${BASE_DIR}/server/php-master.cpp
${BASE_DIR}/server/server-config.cpp
)
endif()

prepend(KPHP_JOB_WORKERS_SOURCES ${BASE_DIR}/server/job-workers/
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/server/server-tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ prepend(SERVER_TESTS_SOURCES ${BASE_DIR}/tests/cpp/server/
workers-control-test.cpp)

# Suppress YAML-cpp-related warnings
if(COMPILER_CLANG)
if(COMPILER_CLANG OR (COMPILER_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")))
allow_deprecated_declarations(${BASE_DIR}/tests/cpp/server/server-config-test.cpp)
endif()

Expand Down
2 changes: 1 addition & 1 deletion third-party/curl-cmake/curl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function(build_curl PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -g0 -Wno-deprecated-declarations ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wno-deprecated-declarations ${extra_compile_flags}")

# Suppress compiler-specific warnings caused by -O3
if(COMPILER_CLANG)
Expand Down
2 changes: 1 addition & 1 deletion third-party/nghttp2-cmake/nghttp2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function(build_nghttp2 PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")

message(STATUS "NGHTTP2 Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/numactl-cmake/numactl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function(build_numactl PIC_ENABLED)

# The configuration has been based on:
# https://sources.debian.org/src/numactl/2.0.12-1/debian/rules/
set(compile_flags "$ENV{CFLAGS} -Wno-unused-but-set-variable -g0 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} -Wno-unused-but-set-variable -g0 -fno-lto ${extra_compile_flags}")

message(STATUS "NUMA Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/openssl-cmake/openssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function(build_openssl PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")

# The configuration has been based on:
# https://packages.debian.org/buster/libssl1.1
Expand Down
2 changes: 1 addition & 1 deletion third-party/pcre-cmake/pcre.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function(build_pcre PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -g0 -Wall ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wall ${extra_compile_flags}")

message(STATUS "PCRE Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/pcre2-cmake/pcre2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function(build_pcre2 PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -O3 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -O3 ${extra_compile_flags}")

message(STATUS "PCRE2 Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/re2-cmake/re2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function(build_re2 PIC_ENABLED)

# The configuration has been based on:
# https://sources.debian.org/src/re2/20190101%2Bdfsg-2/debian/rules/#L5
set(compile_flags "$ENV{CFLAGS} -g0 -Wall -std=c++11 -O3 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wall -std=c++11 -O3 ${extra_compile_flags}")

message(STATUS "RE2 Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/timelib-cmake/timelib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function(build_timelib PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")

message(STATUS "Timelib Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/uber-h3-cmake/uber-h3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function(build_uber_h3 PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")

message(STATUS "Uber-h3 Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/yaml-cpp-cmake/yaml-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function(build_yaml_cpp PIC_ENABLED)
file(MAKE_DIRECTORY ${install_dir})
file(MAKE_DIRECTORY ${include_dirs})

set(compile_flags "$ENV{CFLAGS} -g0 ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 ${extra_compile_flags}")

# Suppress compiler-specific warnings
if(COMPILER_CLANG)
Expand Down
2 changes: 1 addition & 1 deletion third-party/zlib-cmake/zlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function(build_zlib PIC_ENABLED)

# The configuration has been based on:
# https://sources.debian.org/src/zlib/1%3A1.3.dfsg%2Breally1.3.1-1/debian/rules/#L20
set(compile_flags "$ENV{CFLAGS} -g0 -Wall -O3 -D_REENTRANT ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wall -O3 -D_REENTRANT ${extra_compile_flags}")

message(STATUS "Zlib Summary:

Expand Down
2 changes: 1 addition & 1 deletion third-party/zstd-cmake/zstd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function(build_zstd PIC_ENABLED)

# The configuration has been based on:
# https://sources.debian.org/src/libzstd/1.4.8%2Bdfsg-2.1/debian/rules/
set(compile_flags "$ENV{CFLAGS} -g0 -Wno-unused-but-set-variable ${extra_compile_flags}")
set(compile_flags "$ENV{CFLAGS} ${THIRD_PARTY_LTO_OPTIONS} -g0 -Wno-unused-but-set-variable ${extra_compile_flags}")

message(STATUS "ZSTD Summary:

Expand Down
4 changes: 3 additions & 1 deletion vkext/vkext-rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ void update_precise_now() {
}

rpc_connection *rpc_connection_get(int fd) {
rpc_connection **T = tree_lookup_value_connection(rpc_connection_tree, reinterpret_cast<rpc_connection *>(&fd));
static rpc_connection dummy_rpc_connection{};
dummy_rpc_connection.fd = fd;
rpc_connection **T = tree_lookup_value_connection(rpc_connection_tree, reinterpret_cast<rpc_connection *>(&dummy_rpc_connection));
return T ? *T : 0;
}

Expand Down
Loading