Add patch to fix compatibility of FortranCInterface with GCC gfortran 12 LTO
Fixes rhbz#2041904
This commit is contained in:
parent
4663bf397a
commit
8ae403196d
@ -0,0 +1,49 @@
|
||||
From 5ec4aa48f7fb0a6ab4b1385e5512527ecb24f588 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
|
||||
Date: Wed, 19 Jan 2022 17:26:14 +0100
|
||||
Subject: [PATCH] FortranCInterface: Fix compatibility with GCC gfortran 12 LTO
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Since version 12.0 the GCC Fortran compiler has implemented "WG5/N1942",
|
||||
which causes, if link-time opmization is enabled, obfuscation of hard-coded
|
||||
string values in the compiler objects and its resulting ELF-binaries.
|
||||
|
||||
This causes the CMake-internal detection of the mangling scheme for the
|
||||
naming of subroutines to fail. Thus we must ensure to have any link-time
|
||||
optimization features to be disabled on the executable file we perform the
|
||||
detection on.
|
||||
|
||||
Fixes: #23123
|
||||
|
||||
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
|
||||
---
|
||||
Modules/FortranCInterface/CMakeLists.txt | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
|
||||
index 13e4498ad9..6bbb753042 100644
|
||||
--- a/Modules/FortranCInterface/CMakeLists.txt
|
||||
+++ b/Modules/FortranCInterface/CMakeLists.txt
|
||||
@@ -5,6 +5,17 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION})
|
||||
project(FortranCInterface C Fortran)
|
||||
include(${FortranCInterface_BINARY_DIR}/Input.cmake OPTIONAL)
|
||||
|
||||
+# If IPO is enabled here, GCC gfortran >= 12.0 will obfuscate
|
||||
+# the strings of the return values in the compiled executable,
|
||||
+# which we use to regex match against later.
|
||||
+if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
|
||||
+ CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
|
||||
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-lto")
|
||||
+ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-lto")
|
||||
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-lto")
|
||||
+ set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -fno-lto")
|
||||
+endif()
|
||||
+
|
||||
# Check if the C compiler supports '$' in identifiers.
|
||||
include(CheckCSourceCompiles)
|
||||
check_c_source_compiles("
|
||||
--
|
||||
2.34.1
|
||||
|
10
cmake.spec
10
cmake.spec
@ -68,7 +68,7 @@
|
||||
%{?rcsuf:%global versuf -%{rcsuf}}
|
||||
|
||||
# For handling bump release by rpmdev-bumpspec and mass rebuild
|
||||
%global baserelease 5
|
||||
%global baserelease 6
|
||||
|
||||
# Uncomment if building for EPEL
|
||||
#global name_suffix %%{major_version}
|
||||
@ -124,6 +124,10 @@ Patch106: 0006-FindBoost-Do-not-warn-about-now-supported-version-1..patch
|
||||
# FindGLUT: Provide legacy GLUT_INCLUDE_DIR result in pkg-config code path (merged in upstream)
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/23018
|
||||
Patch107: 0007-FindGLUT-Provide-legacy-GLUT_INCLUDE_DIR-result-in-p.patch
|
||||
# FortranCInterface: Fix compatibility with GCC gfortran 12 LTO (proposed PR upstream)
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2041904
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/23123
|
||||
Patch108: 0008-FortranCInterface-Fix-compatibility-with-GCC-gfortra.patch
|
||||
|
||||
# Patch for renaming on EPEL
|
||||
%if 0%{?name_suffix:1}
|
||||
@ -541,6 +545,10 @@ popd
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Jan 19 2022 Björn Esser <besser82@fedoraproject.org> - 3.22.1-6
|
||||
- Add patch to fix compatibility of FortranCInterface with GCC gfortran 12 LTO
|
||||
Fixes rhbz#2041904
|
||||
|
||||
* Sun Dec 26 2021 Björn Esser <besser82@fedoraproject.org> - 3.22.1-5
|
||||
- Backport two patches fixing regressions in FindBoost and FindGLUT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user