[cmake-developers] [CMake 0015737]: Use of redhat-hardened-ld breaks CMake's Fortran compiler library detection for gfortran

Mantis Bug Tracker mantis at public.kitware.com
Fri Sep 11 13:16:47 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15737 
====================================================================== 
Reported By:                Orion Poplawski
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15737
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2015-09-11 13:16 EDT
Last Modified:              2015-09-11 13:16 EDT
====================================================================== 
Summary:                    Use of redhat-hardened-ld breaks CMake's Fortran
compiler library detection for gfortran
Description: 
Fedora is now compiling everything with hardened build options. However this is
breaking CMake's fortran compiler information detection because it incorrectly
picks the wrong link line:

Detecting Fortran compiler ABI info compiled with the following output:
Change Dir:
/home/orion/fedora/psi4/psi4public-1881450f30d3bd2ac91dbc4fc6a4eaa5c9f03ae5/objdir-x86_64-redhat-linux-gnu/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_41086/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_41086.dir/build.make
CMakeFiles/cmTC_41086.dir/build
gmake[1]: Entering directory
'/home/orion/fedora/psi4/psi4public-1881450f30d3bd2ac91dbc4fc6a4eaa5c9f03ae5/objdir-x86_64-redhat-linux-gnu/CMakeFiles/CMakeTmp'
Building Fortran object CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o
/usr/bin/gfortran   -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -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     -c
/usr/share/cmake/Modules/CMakeFortranCompilerABI.F -o
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o
Linking Fortran executable cmTC_41086
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_41086.dir/link.txt
--verbose=1
/usr/bin/gfortran    -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
-v -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-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  
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o  -o cmTC_41086 -rdynamic
Driving: /usr/bin/gfortran -Wl,-z,relro
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -v -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o -o cmTC_41086 -rdynamic -l
gfortran -l m -shared-libgcc
Using built-in specs.
Reading specs from /usr/lib/rpm/redhat/redhat-hardened-ld
Reading specs from /usr/lib/rpm/redhat/redhat-hardened-cc1
COLLECT_GCC=/usr/bin/gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu
--enable-plugin --enable-initfini-array --disable-libgcj --with-isl
--enable-libmpx --enable-gnu-indirect-function --with-tune=generic
--with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/5.1.1/libgfortran.spec
rename spec lib to liborig
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' 'cmTC_41086' '-rdynamic' '-shared-libgcc'
'-march=x86-64' '-pie'
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/:/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/5.1.1/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../:/lib/:/usr/lib/
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' 'cmTC_41086' '-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 cmTC_41086
/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
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.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
gmake[1]: Leaving directory
'/home/orion/fedora/psi4/psi4public-1881450f30d3bd2ac91dbc4fc6a4eaa5c9f03ae5/objdir-x86_64-redhat-linux-gnu/CMakeFiles/CMakeTmp'


Parsed Fortran implicit link information from above output:
  link line regex: [^( *|.*[/\])(ld|([^/\]+-)?ld|collect2)[^/\]*( |$)]
  ignore line: [Change Dir:
/home/orion/fedora/psi4/psi4public-1881450f30d3bd2ac91dbc4fc6a4eaa5c9f03ae5/objdir-x86_64-redhat-linux-gnu/CMakeFiles/CMakeTmp]
  ignore line: []
  ignore line: [Run Build Command:"/usr/bin/gmake" "cmTC_41086/fast"]
  ignore line: [/usr/bin/gmake -f CMakeFiles/cmTC_41086.dir/build.make
CMakeFiles/cmTC_41086.dir/build]
  ignore line: [gmake[1]: Entering directory
'/home/orion/fedora/psi4/psi4public-1881450f30d3bd2ac91dbc4fc6a4eaa5c9f03ae5/objdir-x86_64-redhat-linux-gnu/CMakeFiles/CMakeTmp']
  ignore line: [Building Fortran object
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o]
  ignore line: [/usr/bin/gfortran   -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -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     -c
/usr/share/cmake/Modules/CMakeFortranCompilerABI.F -o
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o]
  ignore line: [Linking Fortran executable cmTC_41086]
  ignore line: [/usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_41086.dir/link.txt --verbose=1]
  ignore line: [/usr/bin/gfortran    -Wl,-z,relro
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -v -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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  
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o  -o cmTC_41086 -rdynamic 
]
  ignore line: [Driving: /usr/bin/gfortran -Wl,-z,relro
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -v -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -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
CMakeFiles/cmTC_41086.dir/CMakeFortranCompilerABI.F.o -o cmTC_41086 -rdynamic -l
gfortran -l m -shared-libgcc]
  ignore line: [Using built-in specs.]
  ignore line: [Reading specs from /usr/lib/rpm/redhat/redhat-hardened-ld]
  ignore line: [Reading specs from /usr/lib/rpm/redhat/redhat-hardened-cc1]
  ignore line: [COLLECT_GCC=/usr/bin/gfortran]
  ignore line:
[COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper]
  ignore line: [Target: x86_64-redhat-linux]
  ignore line: [Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu
--enable-plugin --enable-initfini-array --disable-libgcj --with-isl
--enable-libmpx --enable-gnu-indirect-function --with-tune=generic
--with-arch_32=i686 --build=x86_64-redhat-linux]
  ignore line: [Thread model: posix]
  ignore line: [gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC) ]
  ignore line: [Reading specs from
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/libgfortran.spec]
  ignore line: [rename spec lib to liborig]
  link line:
[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' 'cmTC_41086' '-rdynamic' '-shared-libgcc'
'-march=x86-64' '-pie']
    arg [COLLECT_GCC_OPTIONS=-specs=/usr/lib/rpm/redhat/redhat-hardened-ld] ==>
ignore
    arg [-v] ==> ignore
    arg [-O2] ==> ignore
    arg [-g] ==> ignore
    arg [-pipe] ==> ignore
    arg [-Wall] ==> ignore
    arg [-Werror=format-security] ==> ignore
    arg [-fexceptions] ==> ignore
    arg [-fstack-protector-strong] ==> ignore
    arg [--param] ==> ignore
    arg [ssp-buffer-size=4] ==> ignore
    arg [-grecord-gcc-switches] ==> ignore
    arg [-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1] ==> ignore
    arg [-m64] ==> ignore
    arg [-mtune=generic] ==> ignore
    arg [-I] ==> ignore
    arg [/usr/lib64/gfortran/modules] ==> ignore
    arg [-o] ==> ignore
    arg [cmTC_41086] ==> ignore
    arg [-rdynamic] ==> ignore
    arg [-shared-libgcc] ==> ignore
    arg [-march=x86-64] ==> ignore
    arg [-pie] ==> ignore
  implicit libs: []
  implicit dirs: []
  implicit fwks: []


Steps to Reproduce: 
Compile with LDFLAGS='-Wl,-z,relro
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld'

Additional Information: 
https://bugzilla.redhat.com/show_bug.cgi?id=1260490
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-09-11 13:16 Orion PoplawskiNew Issue                                    
======================================================================



More information about the cmake-developers mailing list