MCPcopy Create free account
hub / github.com/coreboot/coreboot / elf_shdr

Function elf_shdr

util/cbfstool/elfheaders.c:200–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200static void
201elf_shdr(struct buffer *pinput, Elf64_Shdr *shdr,
202 int entsize, struct xdr *xdr, int bit64)
203{
204 /*
205 * The entsize need not be sizeof(*shdr).
206 * Hence, it is easier to keep a copy of the input,
207 * as the xdr functions may not advance the input
208 * pointer the full entsize; rather than get tricky
209 * we just advance it below.
210 */
211 struct buffer input = *pinput;
212 if (bit64){
213 shdr->sh_name = xdr->get32(&input);
214 shdr->sh_type = xdr->get32(&input);
215 shdr->sh_flags = xdr->get64(&input);
216 shdr->sh_addr = xdr->get64(&input);
217 shdr->sh_offset = xdr->get64(&input);
218 shdr->sh_size= xdr->get64(&input);
219 shdr->sh_link = xdr->get32(&input);
220 shdr->sh_info = xdr->get32(&input);
221 shdr->sh_addralign = xdr->get64(&input);
222 shdr->sh_entsize = xdr->get64(&input);
223 } else {
224 shdr->sh_name = xdr->get32(&input);
225 shdr->sh_type = xdr->get32(&input);
226 shdr->sh_flags = xdr->get32(&input);
227 shdr->sh_addr = xdr->get32(&input);
228 shdr->sh_offset = xdr->get32(&input);
229 shdr->sh_size = xdr->get32(&input);
230 shdr->sh_link = xdr->get32(&input);
231 shdr->sh_info = xdr->get32(&input);
232 shdr->sh_addralign = xdr->get32(&input);
233 shdr->sh_entsize = xdr->get32(&input);
234 }
235 buffer_seek(pinput, entsize);
236}
237
238static int
239phdr_read(const struct buffer *in, struct parsed_elf *pelf,

Callers 1

shdr_readFunction · 0.85

Calls 1

buffer_seekFunction · 0.85

Tested by

no test coverage detected