This is a summary of discussions relative to the merge request created by
Torbjörn Svensson (azoff) <[email protected]> titled
c++: ICE on on systems without mmap support [PR124806]
since its creation.
Description: Changes since v1:
- Removed all changes in v1.
- Added member `elf_out::begun`, of type bool, that will track when
`elf_out::begin()` has executed.
- If `elf_out::begun` is true in `efl_out::end()`, then the file is written,
otherwise the write is ignored and only cleanup is performed.
--
Regtested on x86_64-linux-gnu where the `#if 0` has been temporarily changed to
`#if 1` on line 240 of gcc/cp/module.cc to simulate no mmap support.
With this change, I no longer see cc1plus crashing.
I've also confirmed, by only running the modules.exp tests for arm-none-eabi on
Windows, and with the patch, the failures in PR124806 are fixed.
Ok for trunk, releases/gcc-16 and releases/gcc-15?
--
On systems without mmap support, cc1plus can crash when finishing module
output after earlier errors prevented elf_out::begin from running. In
that case elf_out::end attempts to fill in the ELF header even though
hdr.buffer was never initialized.
gcc/cp/ChangeLog:
PR c++/124806
* module.cc (elf_out::begun): New data member
(elf_out::begin): Set it after successful initialization.
(elf_out::end): Do not finalize output that was never begun.
Signed-off-by: Torbjörn SVENSSON <[email protected]>
--
CC: [email protected]
CC: [email protected]
The full and up to date discussion can be found at
https://forge.sourceware.org/gcc/gcc/pulls/204
The merge request has been closed without being merged directly on the forge
repository.
On 2026-07-28 16:22:09+00:00, Torbjörn Svensson (azoff) wrote:
This is apparently causing other issues. I'm investigating...
On 2026-08-10 05:58:43+00:00, Torbjörn Svensson (azoff) wrote:
Pushed as r17-2849-g94556938452d2b, r16-9520-gd564253eb6c859 and
r15-11466-g996979360a4027.