MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / elf_file_load

Function elf_file_load

components/lwp/lwp_elf.c:966–995  ·  view source on GitHub ↗

* @brief Load an ELF file into memory. * * @param load_info Pointer to the elf_load_info_t structure containing information about the ELF file. * * @return RT_EOK if the ELF file is successfully loaded. * @return -RT_ERROR if any error occurs during the loading process. */

Source from the content-addressed store, hash-verified

964 * @return -RT_ERROR if any error occurs during the loading process.
965 */
966static int elf_file_load(elf_load_info_t *load_info)
967{
968 int ret;
969
970 /* Load basic information of the ELF application (ELF header and program header) */
971 ret = elf_load_app(&load_info->exec_info);
972 if (ret != RT_EOK)
973 {
974 goto OUT;
975 }
976
977 /* Load the interpreter (if any) */
978 ret = elf_load_interp(load_info);
979 if (ret != RT_EOK)
980 {
981 goto OUT;
982 }
983
984 /* Load each segment of the ELF file into memory */
985 ret = elf_load_segment(load_info);
986 if (ret != RT_EOK)
987 {
988 goto OUT;
989 }
990
991OUT:
992 /* Perform resource cleanup regardless of success or failure */
993 elf_load_deinit(load_info);
994 return ret;
995}
996
997/**
998 * @brief Load an ELF executable file into memory and prepare it for execution.

Callers 1

lwp_loadFunction · 0.85

Calls 4

elf_load_appFunction · 0.85
elf_load_interpFunction · 0.85
elf_load_segmentFunction · 0.85
elf_load_deinitFunction · 0.85

Tested by

no test coverage detected