summaryrefslogtreecommitdiff
path: root/configure.cmake
diff options
context:
space:
mode:
authorAdeel <adeelbm@outlook.com>2019-05-07 22:50:36 +0000
committerAdeel <adeelbm@outlook.com>2019-05-07 22:50:36 +0000
commitfb17715e97083f47197277133e47cb58b682a888 (patch)
tree3beb5d1ac74f17e78d2d3003ad3c58ad49544a21 /configure.cmake
parent71cae4ca99a163c4fd146e3583c64cb77a83fd0b (diff)
downloadcoreclr-fb17715e97083f47197277133e47cb58b682a888.tar.gz
coreclr-fb17715e97083f47197277133e47cb58b682a888.tar.bz2
coreclr-fb17715e97083f47197277133e47cb58b682a888.zip
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 'configure.cmake')
-rw-r--r--configure.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/configure.cmake b/configure.cmake
index 97b4bc6599..3af13f3c15 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -1,4 +1,5 @@
include(CheckCXXSourceCompiles)
+include(CheckCXXCompilerFlag)
# VC++ guarantees support for LTCG (LTO's equivalent)
if(NOT WIN32)
@@ -9,4 +10,6 @@ if(NOT WIN32)
check_cxx_source_compiles("int main() { return 0; }" HAVE_LTO)
endfunction(check_have_lto)
check_have_lto()
+
+ check_cxx_compiler_flag(-faligned-new COMPILER_SUPPORTS_F_ALIGNED_NEW)
endif(NOT WIN32)