ICE on systems without mmap support when finishing module output
Fixes an internal compiler error (ICE) in `cc1plus` on systems without `mmap` support when handling module output after prior errors.
The C++ compiler (cc1plus) could encounter an internal compiler error (ICE) on systems lacking mmap support. This occurred when module output processing was attempted after earlier errors prevented the elf_out::begin function from running. The fix ensures that elf_out::end does not attempt to finalize output that never properly began, preventing the ICE.
In Details
On systems without mmap support, cc1plus could ICE when elf_out::end was called if elf_out::begin had failed due to earlier errors. The hdr.buffer was uninitialized in such cases, leading to a crash when elf_out::end tried to fill the ELF header. A new elf_out::began flag is introduced to track successful initialization, preventing elf_out::end from finalizing output if begin never ran.
- ICE
- Internal Compiler Error, a situation where the compiler encounters an unexpected condition and cannot continue compilation.
- mmap
- Memory-mapped file I/O, a system call that maps files or devices into memory.
- cc1plus
- The GCC compiler driver for C++.
- module output
- Refers to the process of generating compiled code or intermediate representations for C++ modules.
- ELF header
- The initial part of an ELF (Executable and Linkable Format) file, containing metadata about the file itself.