From: Yoshinori Sato - add PIC binary support --- 25-akpm/arch/h8300/kernel/signal.c | 4 ++++ 25-akpm/fs/binfmt_flat.c | 2 +- 25-akpm/include/asm-h8300/flat.h | 3 ++- 25-akpm/include/asm-h8300/processor.h | 18 +++++++++++++----- 25-akpm/include/asm-m68knommu/flat.h | 2 +- 25-akpm/include/asm-sh/flat.h | 2 +- 25-akpm/include/asm-v850/flat.h | 3 ++- 7 files changed, 24 insertions(+), 10 deletions(-) diff -puN arch/h8300/kernel/signal.c~h8-300-update-3-9-pic-support arch/h8300/kernel/signal.c --- 25/arch/h8300/kernel/signal.c~h8-300-update-3-9-pic-support Tue May 11 17:11:12 2004 +++ 25-akpm/arch/h8300/kernel/signal.c Tue May 11 17:11:12 2004 @@ -192,6 +192,7 @@ restore_sigcontext(struct pt_regs *regs, regs->er1 = context.sc_er1; regs->er2 = context.sc_er2; regs->er3 = context.sc_er3; + regs->er5 = context.sc_er5; regs->ccr = (regs->ccr & 0x10)|(context.sc_ccr & 0xef); regs->pc = context.sc_pc; regs->orig_er0 = -1; /* disable syscall checks */ @@ -308,6 +309,7 @@ static void setup_sigcontext(struct sigc sc->sc_er1 = regs->er1; sc->sc_er2 = regs->er2; sc->sc_er3 = regs->er3; + sc->sc_er5 = regs->er5; sc->sc_ccr = regs->ccr; sc->sc_pc = regs->pc; } @@ -384,6 +386,7 @@ static void setup_frame (int sig, struct ? current_thread_info()->exec_domain->signal_invmap[sig] : sig); regs->er1 = (unsigned long)&(frame->sc); + regs->er5 = current->mm->start_data; /* GOT base */ return; @@ -435,6 +438,7 @@ static void setup_rt_frame (int sig, str : sig); regs->er1 = (unsigned long)&(frame->info); regs->er2 = (unsigned long)&frame->uc; + regs->er5 = current->mm->start_data; /* GOT base */ return; diff -puN fs/binfmt_flat.c~h8-300-update-3-9-pic-support fs/binfmt_flat.c --- 25/fs/binfmt_flat.c~h8-300-update-3-9-pic-support Tue May 11 17:11:12 2004 +++ 25-akpm/fs/binfmt_flat.c Tue May 11 17:11:12 2004 @@ -722,7 +722,7 @@ static int load_flat_file(struct linux_b return -ENOEXEC; /* Get the pointer's value. */ - addr = flat_get_addr_from_rp(rp, relval); + addr = flat_get_addr_from_rp(rp, relval, flags); if (addr != 0) { /* * Do the relocation. PIC relocs in the data section are diff -puN include/asm-h8300/flat.h~h8-300-update-3-9-pic-support include/asm-h8300/flat.h --- 25/include/asm-h8300/flat.h~h8-300-update-3-9-pic-support Tue May 11 17:11:12 2004 +++ 25-akpm/include/asm-h8300/flat.h Tue May 11 17:11:12 2004 @@ -18,7 +18,8 @@ */ #define flat_get_relocate_addr(rel) (rel) -#define flat_get_addr_from_rp(rp, relval) (get_unaligned(rp) & 0x0ffffff) +#define flat_get_addr_from_rp(rp, relval, flags) \ + (get_unaligned(rp) & ((flags & FLAT_FLAG_GOTPIC) ? 0xffffffff: 0x00ffffff)) #define flat_put_addr_at_rp(rp, addr, rel) \ put_unaligned (((*(char *)(rp)) << 24) | ((addr) & 0x00ffffff), rp) diff -puN include/asm-h8300/processor.h~h8-300-update-3-9-pic-support include/asm-h8300/processor.h --- 25/include/asm-h8300/processor.h~h8-300-update-3-9-pic-support Tue May 11 17:11:12 2004 +++ 25-akpm/include/asm-h8300/processor.h Tue May 11 17:11:12 2004 @@ -23,12 +23,12 @@ #include #include -extern inline unsigned long rdusp(void) { +static inline unsigned long rdusp(void) { extern unsigned int sw_usp; return(sw_usp); } -extern inline void wrusp(unsigned long usp) { +static inline void wrusp(unsigned long usp) { extern unsigned int sw_usp; sw_usp = usp; } @@ -61,9 +61,15 @@ struct thread_struct { } breakinfo; }; -#define INIT_THREAD { \ - sizeof(init_stack) + (unsigned long) init_stack, 0, \ - PS_S, 0, {(unsigned short *)-1, 0}, \ +#define INIT_THREAD { \ + .ksp = sizeof(init_stack) + (unsigned long)init_stack, \ + .usp = 0, \ + .ccr = PS_S, \ + .esp0 = 0, \ + .breakinfo = { \ + .addr = (unsigned short *)-1, \ + .inst = 0 \ + } \ } /* @@ -78,6 +84,7 @@ do { \ set_fs(USER_DS); /* reads from user space */ \ (_regs)->pc = (_pc); \ (_regs)->ccr &= 0x00; /* clear kernel flag */ \ + (_regs)->er5 = current->mm->start_data; /* GOT base */ \ wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \ } while(0) #endif @@ -88,6 +95,7 @@ do { \ (_regs)->pc = (_pc); \ (_regs)->ccr = 0x00; /* clear kernel flag */ \ (_regs)->exr = 0x78; /* enable all interrupts */ \ + (_regs)->er5 = current->mm->start_data; /* GOT base */ \ /* 14 = space for retaddr(4), vector(4), er0(4) and ext(2) on stack */ \ wrusp(((unsigned long)(_usp)) - 14); \ } while(0) diff -puN include/asm-m68knommu/flat.h~h8-300-update-3-9-pic-support include/asm-m68knommu/flat.h --- 25/include/asm-m68knommu/flat.h~h8-300-update-3-9-pic-support Tue May 11 17:11:12 2004 +++ 25-akpm/include/asm-m68knommu/flat.h Tue May 11 17:11:12 2004 @@ -9,7 +9,7 @@ #define flat_argvp_envp_on_stack() 1 #define flat_old_ram_flag(flags) (flags) #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) -#define flat_get_addr_from_rp(rp, relval) get_unaligned(rp) +#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp) #define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp) #define flat_get_relocate_addr(rel) (rel) diff -puN include/asm-sh/flat.h~h8-300-update-3-9-pic-support include/asm-sh/flat.h --- 25/include/asm-sh/flat.h~h8-300-update-3-9-pic-support Tue May 11 17:11:12 2004 +++ 25-akpm/include/asm-sh/flat.h Tue May 11 17:11:12 2004 @@ -16,7 +16,7 @@ #define flat_argvp_envp_on_stack() 1 #define flat_old_ram_flag(flags) (flags) #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) -#define flat_get_addr_from_rp(rp, relval) get_unaligned(rp) +#define flat_get_addr_from_rp(rp, relval, flags) get_unaligned(rp) #define flat_put_addr_at_rp(rp, val, relval) put_unaligned(val,rp) #define flat_get_relocate_addr(rel) (rel) diff -puN include/asm-v850/flat.h~h8-300-update-3-9-pic-support include/asm-v850/flat.h --- 25/include/asm-v850/flat.h~h8-300-update-3-9-pic-support Tue May 11 17:11:12 2004 +++ 25-akpm/include/asm-v850/flat.h Tue May 11 17:11:12 2004 @@ -45,7 +45,8 @@ flat_get_relocate_addr (unsigned long re RELVAL is the raw relocation-table entry from which RP is derived. For the v850, RP should always be half-word aligned. */ static inline unsigned long flat_get_addr_from_rp (unsigned long *rp, - unsigned long relval) + unsigned long relval, + unsigned long flags) { short *srp = (short *)rp; _