patch-2.0.15 linux/fs/binfmt_elf.c
Next file: linux/fs/proc/array.c
Previous file: linux/drivers/net/lance.c
Back to the patch index
Back to the overall index
- Lines: 49
- Date:
Wed Aug 21 12:09:31 1996
- Orig file:
v2.0.14/linux/fs/binfmt_elf.c
- Orig date:
Sat Aug 17 21:19:28 1996
diff -u --recursive --new-file v2.0.14/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
@@ -179,6 +179,7 @@
struct elf_phdr *elf_phdata = NULL;
struct elf_phdr *eppnt;
unsigned long load_addr;
+ int load_addr_set = 0;
int elf_exec_fileno;
int retval;
unsigned long last_bss, elf_bss;
@@ -247,7 +248,7 @@
if (eppnt->p_flags & PF_R) elf_prot = PROT_READ;
if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
- if (interp_elf_ex->e_type == ET_EXEC || load_addr != 0) {
+ if (interp_elf_ex->e_type == ET_EXEC || load_addr_set) {
elf_type |= MAP_FIXED;
vaddr = eppnt->p_vaddr;
}
@@ -266,8 +267,10 @@
return ~0UL;
}
- if (!load_addr && interp_elf_ex->e_type == ET_DYN)
+ if (!load_addr_set && interp_elf_ex->e_type == ET_DYN) {
load_addr = error;
+ load_addr_set = 1;
+ }
/*
* Find the end of the file mapping for this phdr, and keep
@@ -365,6 +368,7 @@
struct exec interp_ex;
struct inode *interpreter_inode;
unsigned long load_addr;
+ int load_addr_set = 0;
unsigned int interpreter_type = INTERPRETER_NONE;
unsigned char ibcs2_interpreter;
int i;
@@ -588,8 +592,10 @@
elf_stack = ELF_PAGESTART(elf_ppnt->p_vaddr);
#endif
- if (!load_addr)
+ if (!load_addr_set) {
load_addr = elf_ppnt->p_vaddr - elf_ppnt->p_offset;
+ load_addr_set = 1;
+ }
k = elf_ppnt->p_vaddr;
if (k < start_code) start_code = k;
k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov