* @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. */
| 964 | * @return -RT_ERROR if any error occurs during the loading process. |
| 965 | */ |
| 966 | static 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 | |
| 991 | OUT: |
| 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. |
no test coverage detected