summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-09-08 12:01:14 -0700
committerSimon Horman <horms@verge.net.au>2010-09-09 17:02:54 +0900
commit01d05c34ad65884361cd246483653356403fe8f3 (patch)
tree853620a1b17ec92646bab7f94b3359eaa553e4ce
parentb16f811bb13c44e24425ee96d848ca04838b7d77 (diff)
kexec elf: Handle 64bit elf executables on 32bit platforms.
- Widen some types. Why did I use unsigned long? I guess this code predates the decision to support biarch. - Since I have made the types wider fix the statements that print those types out. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/kexec-elf.c4
-rw-r--r--kexec/kexec-elf.h44
2 files changed, 24 insertions, 24 deletions
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
index 75396ce..b88aced 100644
--- a/kexec/kexec-elf.c
+++ b/kexec/kexec-elf.c
@@ -507,7 +507,7 @@ static int build_mem_elf32_shdr(const char *buf, struct mem_ehdr *ehdr, int idx)
break;
}
if (!size_ok) {
- fprintf(stderr, "Bad section header(%x) entsize: %ld\n",
+ fprintf(stderr, "Bad section header(%x) entsize: %lld\n",
shdr->sh_type, shdr->sh_entsize);
return -1;
}
@@ -576,7 +576,7 @@ static int build_mem_elf64_shdr(const char *buf, struct mem_ehdr *ehdr, int idx)
break;
}
if (!size_ok) {
- fprintf(stderr, "Bad section header(%x) entsize: %ld\n",
+ fprintf(stderr, "Bad section header(%x) entsize: %lld\n",
shdr->sh_type, shdr->sh_entsize);
return -1;
}
diff --git a/kexec/kexec-elf.h b/kexec/kexec-elf.h
index db13001..99cb80b 100644
--- a/kexec/kexec-elf.h
+++ b/kexec/kexec-elf.h
@@ -13,9 +13,9 @@ struct mem_ehdr {
unsigned e_phnum;
unsigned e_shnum;
unsigned e_shstrndx;
- unsigned long e_entry;
- unsigned long e_phoff;
- unsigned long e_shoff;
+ unsigned long long e_entry;
+ unsigned long long e_phoff;
+ unsigned long long e_shoff;
unsigned e_notenum;
struct mem_phdr *e_phdr;
struct mem_shdr *e_shdr;
@@ -24,28 +24,28 @@ struct mem_ehdr {
};
struct mem_phdr {
- unsigned long p_paddr;
- unsigned long p_vaddr;
- unsigned long p_filesz;
- unsigned long p_memsz;
- unsigned long p_offset;
+ unsigned long long p_paddr;
+ unsigned long long p_vaddr;
+ unsigned long long p_filesz;
+ unsigned long long p_memsz;
+ unsigned long long p_offset;
const char *p_data;
unsigned p_type;
unsigned p_flags;
- unsigned p_align;
+ unsigned long long p_align;
};
struct mem_shdr {
unsigned sh_name;
unsigned sh_type;
- unsigned long sh_flags;
- unsigned long sh_addr;
- unsigned long sh_offset;
- unsigned long sh_size;
+ unsigned long long sh_flags;
+ unsigned long long sh_addr;
+ unsigned long long sh_offset;
+ unsigned long long sh_size;
unsigned sh_link;
unsigned sh_info;
- unsigned long sh_addralign;
- unsigned long sh_entsize;
+ unsigned long long sh_addralign;
+ unsigned long long sh_entsize;
const unsigned char *sh_data;
};
@@ -53,16 +53,16 @@ struct mem_sym {
unsigned long st_name; /* Symbol name (string tbl index) */
unsigned char st_info; /* No defined meaning, 0 */
unsigned char st_other; /* Symbol type and binding */
- unsigned long st_shndx; /* Section index */
- unsigned long st_value; /* Symbol value */
- unsigned long st_size; /* Symbol size */
+ unsigned st_shndx; /* Section index */
+ unsigned long long st_value; /* Symbol value */
+ unsigned long long st_size; /* Symbol size */
};
struct mem_rela {
- unsigned long r_offset;
- unsigned long r_sym;
- unsigned long r_type;
- unsigned long r_addend;
+ unsigned long long r_offset;
+ unsigned r_sym;
+ unsigned r_type;
+ unsigned long long r_addend;
};
struct mem_note {