Skip to content

[Bug]: Cannot build 5.8.0 with GCC 14 / RHEL LTO CFLAGS #8843

@space88man

Description

@space88man

Contact Details

shihping.chan@gmail.com

Version

5.8.0

Description

Code does not link with the RHEL 10/GCC 14.2.1 standard CFLAGS

-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer

These are the default CFLAGS that RHEL 10 uses to build packages.

It works if I remove the flags -flto=auto -ffat-lto-objects

Observations

  • succeeds: Fedora 42/GCC 15, RHEL9/gcc-toolset-12, RHEL9/GCC 11

  • reproduces on RHEL9/gcc-toolset-14

  • succeeds on RHEL9/gcc-toolset-13 with minor warnings

     /opt/rh/gcc-toolset-13/root/usr/libexec/gcc/x86_64-redhat-linux/13/ld: wolfcrypt/src/.libs/src_libwolfssl_la-ecc.o: unable to decompress section .gnu.debuglto_.debug_str
     /opt/rh/gcc-toolset-13/root/usr/libexec/gcc/x86_64-redhat-linux/13/ld: wolfcrypt/src/.libs/src_libwolfssl_la-wc_pkcs11.o: unable to decompress section .gnu.debuglto_.debug_str
     /opt/rh/gcc-toolset-13/root/usr/libexec/gcc/x86_64-redhat-linux/13/ld: wolfcrypt/benchmark/benchmark.o: unable to decompress section .gnu.debuglto_.debug_str
    

Reproduction steps

# typical build process on EL-like systems
cd wolfssl-5.8.0/
CFLAGS=' -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer' \
LDFLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1' \
./configure --prefix=/usr --libdir=/usr/lib64
make

# Note: works if -flto=auto -ffat-lto-objects is removed from CFLAGS

Relevant log output

CC       wolfcrypt/src/src_libwolfssl_la-poly1305.lo
  CCLD     src/libwolfssl.la
/usr/bin/ld: wolfcrypt/src/.libs/src_libwolfssl_la-ecc.o: unable to decompress section .gnu.debuglto_.debug_str
/usr/bin/ld: wolfcrypt/src/.libs/src_libwolfssl_la-wc_pkcs11.o: unable to decompress section .gnu.debuglto_.debug_str
/usr/bin/ld: /tmp/ccQCbRZx.ltrans20.ltrans.o: in function `ec_point_convert_to_affine':
/builddir/build/SOURCES/wolfssl-5.8.0/src/pk.c:10771:(.text+0x7fc2): undefined reference to `ecc_map'
/usr/bin/ld: /tmp/ccQCbRZx.ltrans20.ltrans.o: in function `wolfssl_ec_point_add':
/builddir/build/SOURCES/wolfssl-5.8.0/src/pk.c:11072:(.text+0x8a45): undefined reference to `ecc_projective_add_point'
/usr/bin/ld: /builddir/build/SOURCES/wolfssl-5.8.0/src/pk.c:11079:(.text+0x8a69): undefined reference to `ecc_map'
/usr/bin/ld: /tmp/ccQCbRZx.ltrans20.ltrans.o: in function `wolfssl_ec_point_mul':
/builddir/build/SOURCES/wolfssl-5.8.0/src/pk.c:11183:(.text+0x8e95): undefined reference to `ecc_mul2add'
/usr/bin/ld: /tmp/ccQCbRZx.ltrans31.ltrans.o: in function `eccsi_mulmod_base_add.constprop.0':
/builddir/build/SOURCES/wolfssl-5.8.0/wolfcrypt/src/eccsi.c:1368:(.text+0x1b30): undefined reference to `ecc_projective_add_point'
/usr/bin/ld: /builddir/build/SOURCES/wolfssl-5.8.0/wolfcrypt/src/eccsi.c:1372:(.text+0x1b50): undefined reference to `ecc_map'
/usr/bin/ld: /tmp/ccQCbRZx.ltrans5.ltrans.o: in function `wolfCrypt_Init':
/builddir/build/SOURCES/wolfssl-5.8.0/wolfcrypt/src/wc_port.c:362:(.text+0x66a2): undefined reference to `wc_ecc_oid_cache_init'
/usr/bin/ld: /tmp/ccQCbRZx.ltrans5.ltrans.o: in function `wolfCrypt_Cleanup':
/builddir/build/SOURCES/wolfssl-5.8.0/wolfcrypt/src/wc_port.c:460:(.text+0x66f5): undefined reference to `wc_ecc_oid_cache_free'
/usr/bin/ld: /tmp/ccQCbRZx.ltrans7.ltrans.o: in function `EccSpecifiedECDomainDecode.lto_priv.0':
/builddir/build/SOURCES/wolfssl-5.8.0/wolfcrypt/src/asn.c:35244:(.text+0x6a32): undefined reference to `wc_ecc_free_curve'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:6630: src/libwolfssl.la] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/builddir/build/SOURCES/wolfssl-5.8.0'
make[1]: *** [Makefile:10078: all-recursive] Error 1
make[1]: Leaving directory '/builddir/build/SOURCES/wolfssl-5.8.0'
make: *** [Makefile:5680: all] Error 2

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions