summaryrefslogtreecommitdiff
path: root/arch/x86/vdso/vdso2c.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2014-06-07 01:30:37 +0400
committerH. Peter Anvin <hpa@linux.intel.com>2014-06-07 01:54:54 +0400
commitbdfb9bcc25005d06a9c301830bdeb7ca5a0b6ef7 (patch)
tree4598169d540d42653e4dbd320473cb3ea1f6592c /arch/x86/vdso/vdso2c.h
parenta0abcf2e8f8017051830f738ac1bf5ef42703243 (diff)
downloadlinux-bdfb9bcc25005d06a9c301830bdeb7ca5a0b6ef7.tar.xz
x86, vdso: Use <tools/le_byteshift.h> for littleendian access
There are no standard functions for littleendian data (unlike bigendian data.) Thus, use <tools/le_byteshift.h> to access littleendian data members. Those are fairly inefficient, but it doesn't matter for this purpose (and can be optimized later.) This avoids portability problems. Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Tested-by: Andy Lutomirski <luto@amacapital.net> Link: http://lkml.kernel.org/r/20140606140017.afb7f91142f66cb3dd13c186@linux-foundation.org
Diffstat (limited to 'arch/x86/vdso/vdso2c.h')
-rw-r--r--arch/x86/vdso/vdso2c.h62
1 files changed, 31 insertions, 31 deletions
diff --git a/arch/x86/vdso/vdso2c.h b/arch/x86/vdso/vdso2c.h
index d1e99e1892c4..8a074637a576 100644
--- a/arch/x86/vdso/vdso2c.h
+++ b/arch/x86/vdso/vdso2c.h
@@ -18,27 +18,27 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
const char *secstrings;
uint64_t syms[NSYMS] = {};
- Elf_Phdr *pt = (Elf_Phdr *)(addr + GET_LE(hdr->e_phoff));
+ Elf_Phdr *pt = (Elf_Phdr *)(addr + GET_LE(&hdr->e_phoff));
/* Walk the segment table. */
- for (i = 0; i < GET_LE(hdr->e_phnum); i++) {
- if (GET_LE(pt[i].p_type) == PT_LOAD) {
+ for (i = 0; i < GET_LE(&hdr->e_phnum); i++) {
+ if (GET_LE(&pt[i].p_type) == PT_LOAD) {
if (found_load)
fail("multiple PT_LOAD segs\n");
- if (GET_LE(pt[i].p_offset) != 0 ||
- GET_LE(pt[i].p_vaddr) != 0)
+ if (GET_LE(&pt[i].p_offset) != 0 ||
+ GET_LE(&pt[i].p_vaddr) != 0)
fail("PT_LOAD in wrong place\n");
- if (GET_LE(pt[i].p_memsz) != GET_LE(pt[i].p_filesz))
+ if (GET_LE(&pt[i].p_memsz) != GET_LE(&pt[i].p_filesz))
fail("cannot handle memsz != filesz\n");
- load_size = GET_LE(pt[i].p_memsz);
+ load_size = GET_LE(&pt[i].p_memsz);
found_load = 1;
- } else if (GET_LE(pt[i].p_type) == PT_DYNAMIC) {
- dyn = addr + GET_LE(pt[i].p_offset);
- dyn_end = addr + GET_LE(pt[i].p_offset) +
- GET_LE(pt[i].p_memsz);
+ } else if (GET_LE(&pt[i].p_type) == PT_DYNAMIC) {
+ dyn = addr + GET_LE(&pt[i].p_offset);
+ dyn_end = addr + GET_LE(&pt[i].p_offset) +
+ GET_LE(&pt[i].p_memsz);
}
}
if (!found_load)
@@ -47,24 +47,24 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
/* Walk the dynamic table */
for (i = 0; dyn + i < dyn_end &&
- GET_LE(dyn[i].d_tag) != DT_NULL; i++) {
- typeof(dyn[i].d_tag) tag = GET_LE(dyn[i].d_tag);
+ GET_LE(&dyn[i].d_tag) != DT_NULL; i++) {
+ typeof(dyn[i].d_tag) tag = GET_LE(&dyn[i].d_tag);
if (tag == DT_REL || tag == DT_RELSZ ||
tag == DT_RELENT || tag == DT_TEXTREL)
fail("vdso image contains dynamic relocations\n");
}
/* Walk the section table */
- secstrings_hdr = addr + GET_LE(hdr->e_shoff) +
- GET_LE(hdr->e_shentsize)*GET_LE(hdr->e_shstrndx);
- secstrings = addr + GET_LE(secstrings_hdr->sh_offset);
- for (i = 0; i < GET_LE(hdr->e_shnum); i++) {
- Elf_Shdr *sh = addr + GET_LE(hdr->e_shoff) +
- GET_LE(hdr->e_shentsize) * i;
- if (GET_LE(sh->sh_type) == SHT_SYMTAB)
+ secstrings_hdr = addr + GET_LE(&hdr->e_shoff) +
+ GET_LE(&hdr->e_shentsize)*GET_LE(&hdr->e_shstrndx);
+ secstrings = addr + GET_LE(&secstrings_hdr->sh_offset);
+ for (i = 0; i < GET_LE(&hdr->e_shnum); i++) {
+ Elf_Shdr *sh = addr + GET_LE(&hdr->e_shoff) +
+ GET_LE(&hdr->e_shentsize) * i;
+ if (GET_LE(&sh->sh_type) == SHT_SYMTAB)
symtab_hdr = sh;
- if (!strcmp(secstrings + GET_LE(sh->sh_name),
+ if (!strcmp(secstrings + GET_LE(&sh->sh_name),
".altinstructions"))
alt_sec = sh;
}
@@ -72,25 +72,25 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
if (!symtab_hdr)
fail("no symbol table\n");
- strtab_hdr = addr + GET_LE(hdr->e_shoff) +
- GET_LE(hdr->e_shentsize) * GET_LE(symtab_hdr->sh_link);
+ strtab_hdr = addr + GET_LE(&hdr->e_shoff) +
+ GET_LE(&hdr->e_shentsize) * GET_LE(&symtab_hdr->sh_link);
/* Walk the symbol table */
for (i = 0;
- i < GET_LE(symtab_hdr->sh_size) / GET_LE(symtab_hdr->sh_entsize);
+ i < GET_LE(&symtab_hdr->sh_size) / GET_LE(&symtab_hdr->sh_entsize);
i++) {
int k;
- Elf_Sym *sym = addr + GET_LE(symtab_hdr->sh_offset) +
- GET_LE(symtab_hdr->sh_entsize) * i;
- const char *name = addr + GET_LE(strtab_hdr->sh_offset) +
- GET_LE(sym->st_name);
+ Elf_Sym *sym = addr + GET_LE(&symtab_hdr->sh_offset) +
+ GET_LE(&symtab_hdr->sh_entsize) * i;
+ const char *name = addr + GET_LE(&strtab_hdr->sh_offset) +
+ GET_LE(&sym->st_name);
for (k = 0; k < NSYMS; k++) {
if (!strcmp(name, required_syms[k])) {
if (syms[k]) {
fail("duplicate symbol %s\n",
required_syms[k]);
}
- syms[k] = GET_LE(sym->st_value);
+ syms[k] = GET_LE(&sym->st_value);
}
}
}
@@ -150,9 +150,9 @@ static void GOFUNC(void *addr, size_t len, FILE *outfile, const char *name)
fprintf(outfile, "\t},\n");
if (alt_sec) {
fprintf(outfile, "\t.alt = %lu,\n",
- (unsigned long)GET_LE(alt_sec->sh_offset));
+ (unsigned long)GET_LE(&alt_sec->sh_offset));
fprintf(outfile, "\t.alt_len = %lu,\n",
- (unsigned long)GET_LE(alt_sec->sh_size));
+ (unsigned long)GET_LE(&alt_sec->sh_size));
}
for (i = 0; i < NSYMS; i++) {
if (syms[i])