[Bug ld/31824] New: gcc 14 fails during link step on Windows when bootstrap-lto is specified

2024-05-31 Thread tanksherman27 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31824

Bug ID: 31824
   Summary: gcc 14 fails during link step on Windows when
bootstrap-lto is specified
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: tanksherman27 at gmail dot com
  Target Milestone: ---

gcc 14 seems to be unable to link itself when the bootstrap config that is
active is bootstrap-lto, to turn on Link Time Optimization for the gcc being
compiled. The following is the configure command:

  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105507#c3
  # At least with mingw32 + dwarf-2 exceptions there can only be one libgcc in
  # process, or exceptions will no longer work. Since some of the gcc deps are
  # linked dynamically like gmp/zlib/zstd and those pull in libgcc we can't
  # allow libgcc to be linked statically. The default is "-static-libstdc++
  # -static-libgcc" for both, so we drop "-static-libgcc" here:
  # GCC 14 Update: Since we dropped 32bit Ada with GCC 14.1 and GCC doesn't use
  # exceptions elsewhere this could in theory be removed, in case it makes
problems.
  _extra_config+=(
'--with-boot-ldflags="-static-libstdc++"'
'--with-stage1-ldflags="-static-libstdc++"'
  )

  # In addition adaint.c does `#include ` which pulls in msxml.h,
hacky hack:
  CPPFLAGS+=" -DCOM_NO_WINDOWS_H"

  ../${_sourcedir}/configure \
--prefix=${MINGW_PREFIX} \
--with-local-prefix=${MINGW_PREFIX}/local \
--with-build-config='bootstrap-lto' \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--with-native-system-header-dir=${MINGW_PREFIX}/include \
--libexecdir=${MINGW_PREFIX}/lib \
--enable-bootstrap \
--enable-checking=release \
--with-arch=${_arch} \
--with-tune=generic \
--enable-languages=${_languages} \
--enable-shared \
--enable-static \
--enable-libatomic \
--enable-threads=${_threads} \
--enable-graphite \
--enable-fully-dynamic-string \
--enable-libstdcxx-threads \
--enable-libstdcxx-filesystem-ts \
--enable-libstdcxx-time \
--disable-libstdcxx-pch \
--enable-lto \
--enable-libgomp \
--disable-libssp \
--disable-multilib \
--disable-rpath \
--disable-win32-registry \
--disable-nls \
--disable-werror \
--disable-symvers \
--with-libiconv \
--with-system-zlib \
--with-{gmp,mpfr,mpc,isl}=${MINGW_PREFIX} \
--with-pkgversion="Rev${pkgrel}, Built by MSYS2 project" \
--with-bugurl="https://github.com/msys2/MINGW-packages/issues"; \
--with-gnu-as \
--with-gnu-ld \
"${_extra_config[@]}"

...and the invocation of make:

  # https://gcc.gnu.org/onlinedocs/gccint/Makefile.html
  make -O STAGE1_CFLAGS="-O2" \
  --jobs profiledbootstrap

This fails with the following error:

C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 91917
C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 91820
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/lto/Make-lang.in:102: lto-dump.exe] Error 1
make[3]: *** Waiting for unfinished jobs
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/lto/Make-lang.in:96: lto1.exe] Error 1
C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 94928
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/c/Make-lang.in:87: cc1.exe] Error 1
C:\msys64\ucrt64\x86_64-w64-mingw32\bin\ld.exe: error: export ordinal too
large: 97453
collect2.exe: error: ld returned 1 exit status
make[3]: *** [../../gcc-14.1.0/gcc/cp/Make-lang.in:145: cc1plus.exe] Error 1
rm gcc.pod
make[2]: *** [Makefile:5228: all-stageprofile-gcc] Error 2
make[1]: *** [Makefile:23910: stageprofile-bubble] Error 2
make: *** [Makefile:24164: profiledbootstrap] Error 2
==> ERROR: A failure occurred in build().
Aborting...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/12762] LTO on Windows is broken (C++)

2024-07-10 Thread tanksherman27 at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=12762

Julian Waters  changed:

   What|Removed |Added

 CC||tanksherman27 at gmail dot com

--- Comment #36 from Julian Waters  ---
I'm not sure closing this as obsolete without confirming what the remaining
problems are is a good idea, since a hidden bug may still be lurking. Does
anyone here still have any related issues with LTO that can be reproduced?

-- 
You are receiving this mail because:
You are on the CC list for the bug.