From 4ccb585d3f6571a5df7cc9e8260b51d47ec6ad42 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Fri, 11 Sep 2015 13:00:04 -0600 Subject: [PATCH] Apply upstream patch to fix Fortran linker detection with redhat-hardened-ld (bug #1260490) --- cmake.git-97ffbcd8.patch | 57 ++++++++++++++++++++++++++++++++++++++++ cmake.spec | 11 +++++++- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 cmake.git-97ffbcd8.patch diff --git a/cmake.git-97ffbcd8.patch b/cmake.git-97ffbcd8.patch new file mode 100644 index 0000000..f5cb0ad --- /dev/null +++ b/cmake.git-97ffbcd8.patch @@ -0,0 +1,57 @@ +From 97ffbcd8a4be25bbc661c68cb7d866bf9d5008d4 Mon Sep 17 00:00:00 2001 +From: Brad King +Date: Fri, 11 Sep 2015 13:50:34 -0400 +Subject: [PATCH] CMakeParseImplicitLinkInfo: Do not match "VAR=..." as link + line (#15737) + +When compiling with + + LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' + +the compiler output includes a line like + + COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' ... + +that our link line regex matches due to an argument ending in "-ld". +Since it is not really the link line no implicit link information is +dectected. Exclude "VAR=..." lines from consideration as link lines to +fix this. +--- + Modules/CMakeParseImplicitLinkInfo.cmake | 2 +- + Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake +index 8abc465..59092bd 100644 +--- a/Modules/CMakeParseImplicitLinkInfo.cmake ++++ b/Modules/CMakeParseImplicitLinkInfo.cmake +@@ -31,7 +31,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj + # Construct a regex to match linker lines. It must match both the + # whole line and just the command (argv[0]). + set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)") +- set(linker_exclude_regex "collect2 version ") ++ set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=") + set(log "${log} link line regex: [${linker_regex}]\n") + string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") + foreach(line IN LISTS output_lines) +diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +index 055b183..da614e9 100644 +--- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in ++++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +@@ -105,6 +105,13 @@ set(linux64_test2_libs "c;/opt/sun/sunstudio12/prod/lib/amd64/libc_supp.a") + set(linux64_test2_dirs "/opt/sun/sunstudio12/prod/lib/amd64;/lib64;/usr/lib64") + list(APPEND platforms linux64_test2) + ++# -specs=redhat-hardened-ld ++set(linux64_test3_text "COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' '-v' '-O2' '-g' '-pipe' '-Wall' '-Werror=format-security' '-fexceptions' '-fstack-protector-strong' '--param' 'ssp-buffer-size=4' '-grecord-gcc-switches' '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' '-m64' '-mtune=generic' '-I' '/usr/lib64/gfortran/modules' '-o' 'a.out' '-rdynamic' '-shared-libgcc' '-march=x86-64' '-pie' ++ /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/collect2 -plugin /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper -plugin-opt=-fresolution=/tmp/ccNzxFD8.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lquadmath -plugin-opt=-pass-through=-lm -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z now -pie -o a.out /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtbeginS.o -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../.. -z relro dummy.o -lgfortran -lm -lgcc_s -lgcc -lquadmath -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtendS.o /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crtn.o") ++set(linux64_test3_libs "gfortran;m;quadmath;m;c") ++set(linux64_test3_dirs "/usr/lib/gcc/x86_64-redhat-linux/5.1.1;/usr/lib64;/lib64;/usr/lib") ++list(APPEND platforms linux64_test3) ++ + #----------------------------------------------------------------------------- + # Mac + +-- +1.7.10.4 + diff --git a/cmake.spec b/cmake.spec index c45bd04..2f097f6 100644 --- a/cmake.spec +++ b/cmake.spec @@ -13,7 +13,7 @@ Name: cmake Version: 3.3.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Cross-platform make system Group: Development/Tools @@ -38,6 +38,10 @@ Patch1: cmake.git-371fe92e.patch # http://public.kitware.com/Bug/view.php?id=12965 # https://bugzilla.redhat.com/show_bug.cgi?id=822796 Patch2: cmake-findruby.patch +# Fix issue with redhat-hardened-ld +# http://www.cmake.org/Bug/view.php?id=15737 +# https://bugzilla.redhat.com/show_bug.cgi?id=1260490 +Patch3: cmake.git-97ffbcd8.patch ## upstream patches # some post v3.3.1 tag commits @@ -111,6 +115,7 @@ The %{name}-gui package contains the Qt based GUI for CMake. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %patch624 -p1 %patch640 -p1 @@ -285,6 +290,10 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || : %changelog +* Fri Sep 11 2015 Orion Poplawski - 3.3.1-5 +- Apply upstream patch to fix Fortran linker detection with redhat-hardened-ld + (bug #1260490) + * Wed Sep 9 2015 Orion Poplawski - 3.3.1-4 - Apply upstream patch to fix trycompile output (bug #1260490)