/* * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
*/
/* * This file is included up to twice from vdso2c.c. It generates code for * 32-bit and 64-bit vDSOs. We will eventually need both for 64-bit builds, * since 32-bit vDSOs will then be built for 32-bit userspace.
*/
/* Walk the segment table. */ for (i = 0; i < GET_BE(&hdr->e_phnum); i++) { if (GET_BE(&pt[i].p_type) == PT_LOAD) { if (found_load)
fail("multiple PT_LOAD segs\n");
if (GET_BE(&pt[i].p_offset) != 0 ||
GET_BE(&pt[i].p_vaddr) != 0)
fail("PT_LOAD in wrong place\n");
if (GET_BE(&pt[i].p_memsz) != GET_BE(&pt[i].p_filesz))
fail("cannot handle memsz != filesz\n");
if (stripped_len < load_size)
fail("stripped input is too short\n");
/* Walk the dynamic table */ for (i = 0; dyn + i < dyn_end &&
GET_BE(&dyn[i].d_tag) != DT_NULL; i++) {
typeof(dyn[i].d_tag) tag = GET_BE(&dyn[i].d_tag);
typeof(dyn[i].d_un.d_val) val = GET_BE(&dyn[i].d_un.d_val);
if ((tag == DT_RELSZ || tag == DT_RELASZ) && (val != 0))
fail("vdso image contains dynamic relocations\n");
}
/* Walk the section table */ for (i = 0; i < GET_BE(&hdr->e_shnum); i++) {
ELF(Shdr) *sh = raw_addr + GET_BE(&hdr->e_shoff) +
GET_BE(&hdr->e_shentsize) * i; if (GET_BE(&sh->sh_type) == SHT_SYMTAB)
symtab_hdr = sh;
}
for (k = 0; k < NSYMS; k++) { if (!strcmp(name, required_syms[k].name)) { if (syms[k]) {
fail("duplicate symbol %s\n",
required_syms[k].name);
}
/* * Careful: we use negative addresses, but * st_value is unsigned, so we rely * on syms[k] being a signed type of the * correct width.
*/
syms[k] = GET_BE(&sym->st_value);
}
}
}
/* Validate mapping addresses. */ if (syms[sym_vvar_start] % 8192)
fail("vvar_begin must be a multiple of 8192\n");
if (!name) {
fwrite(stripped_addr, stripped_len, 1, outfile); return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.