From 5ede0d3f2daa450ff2518f0efb75661961b46c07 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sun, 17 Feb 2002 11:50:18 +0000 Subject: Some more updates. Darn -- arm needs the mprotect hack --- ldso/ldso/arm/dl-sysdep.h | 35 +++++++++++++++++------------------ ldso/ldso/arm/ld_sysdep.h | 35 +++++++++++++++++------------------ ldso/ldso/ldso.c | 5 +++-- 3 files changed, 37 insertions(+), 38 deletions(-) (limited to 'ldso') diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h index b3d430519..e9905d83e 100644 --- a/ldso/ldso/arm/dl-sysdep.h +++ b/ldso/ldso/arm/dl-sysdep.h @@ -37,24 +37,22 @@ *REL += SYMBOL; \ break; \ case R_ARM_PC24: \ - { \ - unsigned long newval, topbits; \ - long addend=*REL & 0x00ffffff; \ - if(addend & 0x00800000) \ - addend|=0xff000000; \ - newval=SYMBOL- ((unsigned long)REL) + (addend<<2); \ - topbits=newval & 0xfe000000; \ - if (topbits != 0xfe000000 && topbits != 0x00000000) {/* \ - newval=fix_bad_pc24(REL,value) - \ - ((unsigned long)REL) + (addend << 2); \ - topbits=newval & 0xfe000000; \ - if(topbits != 0xfe000000 && topbits != 0x00000000)*/ \ - _dl_exit(1); \ - } \ - newval>>=2; \ - SYMBOL= (*REL & 0xff000000)|(newval & 0x00ffffff); \ + { long newvalue, topbits; \ + unsigned long addend = *REL & 0x00ffffff; \ + if (addend & 0x00800000) addend |= 0xff000000; \ + newvalue=SYMBOL-(unsigned long)REL+(addend<<2); \ + topbits = newvalue & 0xfe000000; \ + if (topbits!=0xfe000000&&topbits!=0x00000000){ \ + newvalue = fix_bad_pc24(REL, SYMBOL) \ + -(unsigned long)REL+(addend<<2); \ + topbits = newvalue & 0xfe000000; \ + if (topbits!=0xfe000000&&topbits!=0x00000000){ \ + SEND_STDERR("R_ARM_PC24 relocation out of range\n");\ + _dl_exit(1); } } \ + newvalue>>=2; \ + SYMBOL=(*REL&0xff000000)|(newvalue & 0x00ffffff); \ *REL=SYMBOL; \ - } \ + } \ break; \ case R_ARM_GLOB_DAT: \ case R_ARM_JUMP_SLOT: \ @@ -66,6 +64,7 @@ case R_ARM_NONE: \ break; \ default: \ + SEND_STDERR("Aiieeee!"); \ _dl_exit(1); \ } @@ -88,7 +87,7 @@ #define ELF_TARGET "ARM" struct elf_resolve; -extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); +unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); static inline unsigned long arm_modulus(unsigned long m, unsigned long p) { unsigned long i,t,inc; diff --git a/ldso/ldso/arm/ld_sysdep.h b/ldso/ldso/arm/ld_sysdep.h index b3d430519..e9905d83e 100644 --- a/ldso/ldso/arm/ld_sysdep.h +++ b/ldso/ldso/arm/ld_sysdep.h @@ -37,24 +37,22 @@ *REL += SYMBOL; \ break; \ case R_ARM_PC24: \ - { \ - unsigned long newval, topbits; \ - long addend=*REL & 0x00ffffff; \ - if(addend & 0x00800000) \ - addend|=0xff000000; \ - newval=SYMBOL- ((unsigned long)REL) + (addend<<2); \ - topbits=newval & 0xfe000000; \ - if (topbits != 0xfe000000 && topbits != 0x00000000) {/* \ - newval=fix_bad_pc24(REL,value) - \ - ((unsigned long)REL) + (addend << 2); \ - topbits=newval & 0xfe000000; \ - if(topbits != 0xfe000000 && topbits != 0x00000000)*/ \ - _dl_exit(1); \ - } \ - newval>>=2; \ - SYMBOL= (*REL & 0xff000000)|(newval & 0x00ffffff); \ + { long newvalue, topbits; \ + unsigned long addend = *REL & 0x00ffffff; \ + if (addend & 0x00800000) addend |= 0xff000000; \ + newvalue=SYMBOL-(unsigned long)REL+(addend<<2); \ + topbits = newvalue & 0xfe000000; \ + if (topbits!=0xfe000000&&topbits!=0x00000000){ \ + newvalue = fix_bad_pc24(REL, SYMBOL) \ + -(unsigned long)REL+(addend<<2); \ + topbits = newvalue & 0xfe000000; \ + if (topbits!=0xfe000000&&topbits!=0x00000000){ \ + SEND_STDERR("R_ARM_PC24 relocation out of range\n");\ + _dl_exit(1); } } \ + newvalue>>=2; \ + SYMBOL=(*REL&0xff000000)|(newvalue & 0x00ffffff); \ *REL=SYMBOL; \ - } \ + } \ break; \ case R_ARM_GLOB_DAT: \ case R_ARM_JUMP_SLOT: \ @@ -66,6 +64,7 @@ case R_ARM_NONE: \ break; \ default: \ + SEND_STDERR("Aiieeee!"); \ _dl_exit(1); \ } @@ -88,7 +87,7 @@ #define ELF_TARGET "ARM" struct elf_resolve; -extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); +unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); static inline unsigned long arm_modulus(unsigned long m, unsigned long p) { unsigned long i,t,inc; diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index b330fa6d6..300bef758 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -23,8 +23,9 @@ /* Enable this to turn on debugging noise */ //#define DL_DEBUG -/* Enable mprotect protection munging. We don't need this for Linux */ -//#define DO_MPROTECT_HACKS +/* Enable mprotect protection munging. ARM Linux needs this it seems, + * so leave this enabled by default */ +#define DO_MPROTECT_HACKS // Support a list of library preloads in /etc/ld.so.preload //#define SUPPORT_LDSO_PRELOAD_FILE -- cgit v1.2.3