stand: Load INIT_ARRAY and FINI_ARRAY sections

This is required for preloading modules into a KASAN-configured kernel.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2021-03-16 15:01:41 -04:00 committed by Mark Johnston
parent 4aa157dd5b
commit 7b1b5aad95

View File

@ -264,6 +264,8 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off)
#if defined(__i386__) || defined(__amd64__)
case SHT_X86_64_UNWIND:
#endif
case SHT_INIT_ARRAY:
case SHT_FINI_ARRAY:
if ((shdr[i].sh_flags & SHF_ALLOC) == 0)
break;
lastaddr = roundup(lastaddr, shdr[i].sh_addralign);