https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81968
--- Comment #29 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > It does by removing the SHT_NULL sections. The patch should work - you > can double-check - it just doesn't handle the "corner case" of more > than 32000 input sections correctly when rewriting the symbol table. There is one nit with -g3 on x86-64/Linux: FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g3 (test for excess errors) FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g3 -O (test for excess errors) FAIL: gcc.dg/debug/pr41893-1.c -gdwarf-2 -g3 -O3 (test for excess errors) /home/eric/install/gcc/x86_64-suse-linux/bin/ld: /tmp/ccyqoYHFdebugobjtem: no group info for section .debug_macro /home/eric/install/gcc/x86_64-suse-linux/bin/ld: /tmp/ccyqoYHFdebugobjtem: no group info for section .debug_macro /home/eric/install/gcc/x86_64-suse-linux/bin/ld: /tmp/ccyqoYHFdebugobjtem: no group info for section .debug_macro /home/eric/install/gcc/x86_64-suse-linux/bin/ld: /tmp/ccyqoYHFdebugobjtem: no group info for section .debug_macro /home/eric/install/gcc/x86_64-suse-linux/bin/ld: /tmp/ccyqoYHFdebugobjtem: no group info for section .debug_macro /home/eric/install/gcc/x86_64-suse-linux/bin/ld: /tmp/ccyqoYHFdebugobjtem: no group info for section .debug_macro /tmp/ccyqoYHFdebugobjtem: file not recognized: Bad value collect2: error: ld returned 1 exit status lto-wrapper: fatal error: gcc/xgcc returned 1 exit status compilation terminated. /home/eric/install/gcc/x86_64-suse-linux/bin/ld: error: lto-wrapper failed