diff options
Diffstat (limited to 'ldso/ldso/frv')
-rw-r--r-- | ldso/ldso/frv/dl-inlines.h | 12 | ||||
-rw-r--r-- | ldso/ldso/frv/dl-startup.h | 4 | ||||
-rw-r--r-- | ldso/ldso/frv/dl-sysdep.h | 26 | ||||
-rw-r--r-- | ldso/ldso/frv/elfinterp.c | 7 |
4 files changed, 36 insertions, 13 deletions
diff --git a/ldso/ldso/frv/dl-inlines.h b/ldso/ldso/frv/dl-inlines.h index f09c8b93a..855362e10 100644 --- a/ldso/ldso/frv/dl-inlines.h +++ b/ldso/ldso/frv/dl-inlines.h @@ -414,11 +414,11 @@ _dl_funcdesc_for (void *entry_point, void *got_value) return _dl_stabilize_funcdesc (*entry); } -inline static void * -_dl_lookup_address (void *address) +inline static void const * +_dl_lookup_address (void const *address) { struct elf_resolve *rpnt; - struct funcdesc_value *fd; + struct funcdesc_value const *fd; /* Make sure we don't make assumptions about its alignment. */ asm ("" : "+r" (address)); @@ -427,7 +427,7 @@ _dl_lookup_address (void *address) /* It's not a function descriptor. */ return address; - fd = (struct funcdesc_value *)address; + fd = (struct funcdesc_value const *)address; for (rpnt = _dl_loaded_modules; rpnt; rpnt = rpnt->next) { @@ -439,9 +439,9 @@ _dl_lookup_address (void *address) address = htab_find_slot (rpnt->funcdesc_ht, (void*)fd->entry_point, 0); - if (address && *(struct funcdesc_value **)address == fd) + if (address && *(struct funcdesc_value *const*)address == fd) { - address = (*(struct funcdesc_value **)address)->entry_point; + address = (*(struct funcdesc_value *const*)address)->entry_point; break; } else diff --git a/ldso/ldso/frv/dl-startup.h b/ldso/ldso/frv/dl-startup.h index 98c5677f6..46875c95e 100644 --- a/ldso/ldso/frv/dl-startup.h +++ b/ldso/ldso/frv/dl-startup.h @@ -145,7 +145,3 @@ struct elf32_fdpic_loadmap; /* _dl_dprintf(2, "entry point is (%x,%x)\n", dl_main_funcdesc->entry_point, dl_main_funcdesc->got_value); */ \ return; \ } while (0) - - - - diff --git a/ldso/ldso/frv/dl-sysdep.h b/ldso/ldso/frv/dl-sysdep.h index 32d540caf..158f6af04 100644 --- a/ldso/ldso/frv/dl-sysdep.h +++ b/ldso/ldso/frv/dl-sysdep.h @@ -129,6 +129,16 @@ struct funcdesc_ht; #define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \ (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr)) +/* Make sure we only load libraries that use the same number of + general-purpose and floating-point registers the dynamic loader was + compiled for. */ +#define DL_CHECK_REG_COUNT(flags) \ + (((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_32 ? __FRV_GPR__ == 32 : 1) \ + && ((flags & EF_FRV_GPR_MASK) == EF_FRV_GPR_64 ? __FRV_GPR__ == 64 : 1) \ + && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_32 ? __FRV_FPR__ == 32 : 1) \ + && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_64 ? __FRV_FPR__ == 64 : 1) \ + && ((flags & EF_FRV_FPR_MASK) == EF_FRV_FPR_NONE ? __FRV_FPR__ == 0 : 1)) + /* We only support loading FDPIC independently-relocatable shared libraries. It probably wouldn't be too hard to support loading shared libraries that require relocation by the same amount, but we @@ -149,6 +159,14 @@ do \ _dl_close(infile); \ return NULL; \ } \ +\ + if (! DL_CHECK_REG_COUNT ((epnt)->e_flags)) \ + { \ + _dl_internal_error_number = LD_ERROR_NOTDYN; \ + _dl_dprintf(2, "%s: '%s' assumes different register counts" \ + "\n", (_dl_progname), (libname)); \ + _dl_close(infile); \ + } \ } \ while (0) @@ -172,6 +190,14 @@ while (0) (TPNT)->loadaddr.got_value) \ : DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr)) +#define DL_GET_READY_TO_RUN_EXTRA_PARMS \ + , struct elf32_fdpic_loadmap *dl_boot_progmap +#define DL_GET_READY_TO_RUN_EXTRA_ARGS \ + , dl_boot_progmap + + + + #ifdef __USE_GNU # include <link.h> #else diff --git a/ldso/ldso/frv/elfinterp.c b/ldso/ldso/frv/elfinterp.c index 2b2891880..9ab1a9777 100644 --- a/ldso/ldso/frv/elfinterp.c +++ b/ldso/ldso/frv/elfinterp.c @@ -153,10 +153,11 @@ _dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry) DL_RELOC_ADDR (this_reloc->r_offset, tpnt->loadaddr); /* Get the address to be used to fill in the GOT entry. */ - new_addr = _dl_find_hash_mod(symname, tpnt->symbol_scope, 0, + new_addr = _dl_find_hash_mod(symname, tpnt->symbol_scope, NULL, 0, &new_tpnt); if (!new_addr) { - new_addr = _dl_find_hash_mod(symname, NULL, 0, &new_tpnt); + new_addr = _dl_find_hash_mod(symname, NULL, NULL, 0, + &new_tpnt); if (!new_addr) { _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname); @@ -278,7 +279,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, } else { symbol_addr = (unsigned long) - _dl_find_hash_mod(symname, scope, 0, &symbol_tpnt); + _dl_find_hash_mod(symname, scope, NULL, 0, &symbol_tpnt); /* * We want to allow undefined references to weak symbols - this might |