INN commit: branches/2.6 (configure.ac)

INN Commit rra at isc.org
Tue Jan 5 16:06:30 UTC 2021


    Date: Tuesday, January 5, 2021 @ 08:06:30
  Author: iulius
Revision: 10497

Add -fstack-protector-strong for linking if recognized

Building innd on Solaris fails if the compiler does not have
amongst its flags -fstack-protector-strong for linking.

Undefined                       first referenced
 symbol                             in file
__stack_chk_fail                    art.o
__stack_chk_guard                   art.o
ld: fatal: symbol referencing errors

Also, if the compiler does not support -fstack-protector-strong
for linking, assume it will not work, and remove that flag even
for compiling (AIX typically does not have libssp_nonshared). 

Modified:
  branches/2.6/configure.ac

--------------+
 configure.ac |    8 ++++++++
 1 file changed, 8 insertions(+)

Modified: configure.ac
===================================================================
--- configure.ac	2021-01-05 15:47:46 UTC (rev 10496)
+++ configure.ac	2021-01-05 16:06:30 UTC (rev 10497)
@@ -622,6 +622,10 @@
 INN_LOG_FACILITY
 
 dnl Add hardening build flags, if supported by the compiler.
+dnl Solaris has a separate libssp, so -fstack-protector-strong also has
+dnl to be passed to the linker.  And we assume that if the linker does not
+dnl accept -fstack-protector-strong, the build is likely to fail (like on AIX
+dnl where libssp_nonshared may not be present).
 AS_IF([test x"$inn_enable_hardening_flags" = xyes],
     [INN_PROG_CC_FLAG([-fPIE], [CFLAGS="${CFLAGS} -fPIE"
                                 CC_WARNINGS="${CC_WARNINGS} -fPIE"
@@ -631,6 +635,10 @@
                       [CFLAGS="${CFLAGS} -fstack-protector-strong"
                        CC_WARNINGS="${CC_WARNINGS} -fstack-protector-strong"],
                       [])
+     INN_PROG_LD_FLAG([-fstack-protector-strong],
+                      [LDFLAGS="${LDFLAGS} -fstack-protector-strong"],
+                      [CFLAGS=`echo "${CFLAGS}" | sed 's/ -fstack-protector-strong//'`
+                       CC_WARNINGS=`echo "${CC_WARNINGS}" | sed 's/ -fstack-protector-strong//'`])
      INN_PROG_LD_FLAG([-Wl,-z,relro],
                       [LDFLAGS="${LDFLAGS} -Wl,-z,relro"], [])
      INN_PROG_LD_FLAG([-Wl,-z,now],



More information about the inn-committers mailing list