MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_elf_header

Function check_elf_header

dpdk/lib/bpf/bpf_load_elf.c:103–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103static int
104check_elf_header(const Elf64_Ehdr *eh)
105{
106 const char *err;
107
108 err = NULL;
109
110#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
111 if (eh->e_ident[EI_DATA] != ELFDATA2LSB)
112#else
113 if (eh->e_ident[EI_DATA] != ELFDATA2MSB)
114#endif
115 err = "not native byte order";
116 else if (eh->e_ident[EI_OSABI] != ELFOSABI_NONE)
117 err = "unexpected OS ABI";
118 else if (eh->e_type != ET_REL)
119 err = "unexpected ELF type";
120 else if (eh->e_machine != EM_NONE && eh->e_machine != EM_BPF)
121 err = "unexpected machine type";
122
123 if (err != NULL) {
124 RTE_BPF_LOG(ERR, "%s(): %s\n", __func__, err);
125 return -EINVAL;
126 }
127
128 return 0;
129}
130
131/*
132 * helper function, find executable section by name.

Callers 1

find_elf_codeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected