summaryrefslogtreecommitdiff
path: root/configurecompiler.cmake
diff options
context:
space:
mode:
authorAdeel <adeelbm@outlook.com>2019-05-07 22:50:36 (GMT)
committerAdeel <adeelbm@outlook.com>2019-05-07 22:50:36 (GMT)
commitfb17715e97083f47197277133e47cb58b682a888 (patch)
tree3beb5d1ac74f17e78d2d3003ad3c58ad49544a21 /configurecompiler.cmake
parent71cae4ca99a163c4fd146e3583c64cb77a83fd0b (diff)
downloadcoreclr-fb17715e97083f47197277133e47cb58b682a888.zip
coreclr-fb17715e97083f47197277133e47cb58b682a888.tar.gz
coreclr-fb17715e97083f47197277133e47cb58b682a888.tar.bz2
Use -falign-new flag for gcc 7+
Versions of gcc lower than 7 do not have C++17's "over-aligned new" support. With gcc 7 and 8, following error is thrown: ``` /datadrive/projects/coreclr/src/vm/threadpoolrequest.cpp: In static member function static TPIndex PerAppDomainTPCountList::AddNewTPIndex(): /datadrive/projects/coreclr/src/vm/threadpoolrequest.cpp:79:81: error: new of type ManagedPerAppDomainTPCount with extended alignment 64 [-Werror=aligned-new=] ManagedPerAppDomainTPCount * pAdCount = new ManagedPerAppDomainTPCount(index); ^ /datadrive/projects/coreclr/src/vm/threadpoolrequest.cpp:79:81: note: uses void* operator new(size_t), which does not have an alignment parameter /datadrive/projects/coreclr/src/vm/threadpoolrequest.cpp:79:81: note: use -faligned-new to enable C++17 over-aligned new support ``` The fix is to enable `-falign-new` (without fully activating C++17 features), that does auto-alignment like gcc 6x and below and clang.
Diffstat (limited to 'configurecompiler.cmake')
-rw-r--r--configurecompiler.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/configurecompiler.cmake b/configurecompiler.cmake
index 929dfe5..38d8d43 100644
--- a/configurecompiler.cmake
+++ b/configurecompiler.cmake
@@ -485,6 +485,9 @@ if (CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-Wno-unused-but-set-variable)
add_compile_options(-fms-extensions)
add_compile_options(-Wno-unknown-pragmas)
+ if (COMPILER_SUPPORTS_F_ALIGNED_NEW)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new")
+ endif()
endif()
# Some architectures (e.g., ARM) assume char type is unsigned while CoreCLR assumes char is signed