https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116614
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I've been testing 2024-09-05 Jakub Jelinek <ja...@redhat.com> PR lto/116614 * simple-object-elf.c (SHN_COMMON): Align comment with neighbouring comments. (SHN_HIRESERVE): Use uppercase hex digits instead of lowercase for consistency. (simple_object_elf_copy_lto_debug_section): Don't fail for new_i - 1 >= SHN_LORESERVE. --- libiberty/simple-object-elf.c.jj 2024-01-03 12:07:48.461085637 +0100 +++ libiberty/simple-object-elf.c 2024-09-05 18:33:28.761156351 +0200 @@ -128,9 +128,9 @@ typedef struct { #define SHN_UNDEF 0 /* Undefined section */ #define SHN_LORESERVE 0xFF00 /* Begin range of reserved indices */ -#define SHN_COMMON 0xFFF2 /* Associated symbol is in common */ +#define SHN_COMMON 0xFFF2 /* Associated symbol is in common */ #define SHN_XINDEX 0xFFFF /* Section index is held elsewhere */ -#define SHN_HIRESERVE 0xffff /* End of reserved indices */ +#define SHN_HIRESERVE 0xFFFF /* End of reserved indices */ /* 32-bit ELF program header. */ @@ -1291,11 +1291,6 @@ simple_object_elf_copy_lto_debug_section else sh_map[i] = new_i++; } - if (new_i - 1 >= SHN_LORESERVE) - { - *err = ENOTSUP; - return "Too many copied sections"; - } eow->shdrs = XNEWVEC (unsigned char, shdr_size * (new_i - 1)); /* Then perform the actual copying. */ overnight. I think for PR93117 maybe what mattered is that PR104617 wasn't fixed at that point yet. In any case, readelf seems to be happy with the resulting debug temp file.