[Git][ghc/ghc][master] rts: Handle overflow of ELF section header string table
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: c71faa76 by Luite Stegeman at 2025-12-01T03:16:05-05:00 rts: Handle overflow of ELF section header string table If the section header string table is stored in a section greater than or equal to SHN_LORESERVE (0xff00), the 16-bit field e_shstrndx in the ELF header does not contain the section number, but rather an overflow value SHN_XINDEX (0xffff) indicating that we need to look elsewhere. This fixes the linker by not using e_shstrndx directly but calling elf_shstrndx, which correctly handles the SHN_XINDEX value. Fixes #26603 - - - - - 1 changed file: - rts/linker/Elf.c Changes: ===================================== rts/linker/Elf.c ===================================== @@ -205,7 +205,7 @@ ocInit_ELF(ObjectCode * oc) oc->info->sectionHeader = (Elf_Shdr *) ((uint8_t*)oc->image + oc->info->elfHeader->e_shoff); oc->info->sectionHeaderStrtab = (char*)((uint8_t*)oc->image + - oc->info->sectionHeader[oc->info->elfHeader->e_shstrndx].sh_offset); + oc->info->sectionHeader[elf_shstrndx(oc->info->elfHeader)].sh_offset); oc->n_sections = elf_shnum(oc->info->elfHeader); View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c71faa7697f2d0bc8b92173aeb1f063c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c71faa7697f2d0bc8b92173aeb1f063c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)