[hjl@gnu-skx-1 tmp]$ cat pr15323a.c int main (void) { return 0; } [hjl@gnu-skx-1 tmp]$ cat doit CFLAGS="-flto -fno-profile-use -O2" cc $CFLAGS -c pr15323a.c -o pr15323a.o cc $CFLAGS -r -nostdlib pr15323a.o -o pr15323a-r.o cc $CFLAGS -o pr15323a.exe pr15323a-r.o [hjl@gnu-skx-1 tmp]$ sh doit during IPA pass: cp lto1: internal compiler error: decompressed stream: Destination buffer is too small Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. lto-wrapper: fatal error: cc returned 1 exit status compilation terminated. /usr/local/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status [hjl@gnu-skx-1 tmp]$
It works for me. What compression scheme are you using? I have Supported LTO compression algorithms: zlib are you using zstd, if so, which version?
I can reproduce it, working on that..
Started with my r10-1548-g87741e51b53511be. It's caused by the fact that .gnu.lto_.jmpfuncs.3f272ba23409d5d4 is streamed twise: from "cp" pass and then from "fnsummary" pass.
Then we end up with 2 copies of the compressed stream: $ cat good.txt y.o: file format elf64-x86-64 Contents of section .gnu.lto_.jmpfuncs.c09bc76fb7147437: 0000 28b52ffd 20116d00 00380500 01000000 (./. .m..8...... 0010 0001001b c002 ...... $ cat bad.txt y.o: file format elf64-x86-64 Contents of section .gnu.lto_.jmpfuncs.9e830355985c8f8c: 0000 28b52ffd 20116d00 00380500 01000000 (./. .m..8...... 0010 0001001b c00228b5 2ffd2011 6d000038 ......(./. .m..8 0020 05000100 00000001 001bc002 ............ Then we tell zstd section size and decompression fails as zstd frame header contains a smaller size.
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>: https://gcc.gnu.org/g:568de14d2e74cfdd600b8995ff6ac08c98ddef48 commit r11-4526-g568de14d2e74cfdd600b8995ff6ac08c98ddef48 Author: Martin Liska <mliska@suse.cz> Date: Wed Oct 21 11:11:03 2020 +0200 LTO: get_section: add new argument gcc/ChangeLog: PR lto/97508 * langhooks.c (lhd_begin_section): Call get_section with not_existing = true. * output.h (get_section): Add new argument. * varasm.c (get_section): Fail when NOT_EXISTING is true and a section already exists. * ipa-cp.c (ipcp_write_summary): Remove. (ipcp_read_summary): Likewise. * ipa-fnsummary.c (ipa_fn_summary_read): Always read jump functions summary. (ipa_fn_summary_write): Always stream it.
Fixed on master so far.
The releases/gcc-10 branch has been updated by Martin Liska <marxin@gcc.gnu.org>: https://gcc.gnu.org/g:32d16af0c4ede8d008d4360cca7c805db518166f commit r10-8954-g32d16af0c4ede8d008d4360cca7c805db518166f Author: Martin Liska <mliska@suse.cz> Date: Wed Oct 21 11:11:03 2020 +0200 LTO: get_section: add new argument gcc/ChangeLog: PR lto/97508 * langhooks.c (lhd_begin_section): Call get_section with not_existing = true. * output.h (get_section): Add new argument. * varasm.c (get_section): Fail when NOT_EXISTING is true and a section already exists. * ipa-cp.c (ipcp_write_summary): Remove. (ipcp_read_summary): Likewise. * ipa-fnsummary.c (ipa_fn_summary_read): Always read jump functions summary. (ipa_fn_summary_write): Always stream it. (cherry picked from commit 568de14d2e74cfdd600b8995ff6ac08c98ddef48)
Fixed now.