删除旧的libELF (#324)

This commit is contained in:
LoGin 2023-08-08 23:45:04 +08:00 committed by GitHub
parent 6d81180b3b
commit 42c97fa7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 4205 deletions

View File

@ -1,7 +1,7 @@
CFLAGS += -I .
kernel_lib_subdirs:= libUI sys libELF
kernel_lib_subdirs:= libUI sys
kernel_lib_objs:= $(shell find ./*.c)

View File

@ -1,8 +0,0 @@
all: elf.o
CFLAGS += -I .
elf.o: elf.c
$(CC) $(CFLAGS) -c elf.c -o elf.o

View File

@ -1,33 +0,0 @@
#include "elf.h"
#include <common/unistd.h>
#include <common/glib.h>
/**
* @brief ELF文件
*
* @param ehdr
*/
bool elf_check(void *ehdr)
{
Elf32_Ehdr *ptr = (Elf32_Ehdr *)ehdr;
bool flag = ptr->e_ident[EI_MAG0] == ELFMAG0 && ptr->e_ident[EI_MAG1] == ELFMAG1 && ptr->e_ident[EI_MAG2] == ELFMAG2 && ptr->e_ident[EI_MAG3] == ELFMAG3;
// 标头已经不符合要求
if (!flag)
return false;
// 检验EI_CLASS是否合法
if (ptr->e_ident[EI_CLASS] == 0 || ptr->e_ident[EI_CLASS] > 2)
return false;
// 检验EI_DATA是否合法
if (ptr->e_ident[EI_DATA] == 0 || ptr->e_ident[EI_DATA] > 2)
return false;
// 检验EI_VERSION是否合法
if(ptr->e_ident[EI_VERSION]==EV_NONE)
return false;
// 是elf文件
return true;
}

File diff suppressed because it is too large Load Diff