{
unsigned long i,t,inc;
i=p; t=0;
- while(!(i&(1<<31))) {
+ while (!(i&(1<<31))) {
i<<=1;
t++;
}
t--;
- for(inc=t;inc>2;inc--) {
+ for (inc=t;inc>2;inc--) {
i=p<<inc;
- if(i&(1<<31))
+ if (i&(1<<31))
break;
- while(m>=i) {
+ while (m>=i) {
m-=i;
i<<=1;
- if(i&(1<<31))
+ if (i&(1<<31))
break;
- if(i<p)
+ if (i<p)
break;
}
}
- while(m>=p) {
+ while (m>=p) {
m-=p;
}
return m;
_dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n",
_dl_progname);
_dl_exit(1);
- };
+ }
/* Address of jump instruction to fix up */
instr_addr = ((unsigned long) this_reloc->r_offset +
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
_dl_progname, symname);
_dl_exit(1);
- };
+ }
#if defined (__SUPPORT_LD_DEBUG__)
if ((unsigned long) got_addr < 0x40000000)
{
if (_dl_debug_bindings)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if (_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr);
}
}
return -1; /*call _dl_exit(1) */
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
return -1; /*call _dl_exit(1) */
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatch: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
}
if (unlikely(!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK)) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
_dl_exit(1);
- };
+ }
symbol_addr += rpnt->r_addend;
}
if (_dl_debug_bindings)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
- if(_dl_debug_detail)
+ if (_dl_debug_detail)
_dl_dprintf(_dl_debug_file,
"\n\tpatched (%x,%x) ==> (%x,%x) @ %x\n",
got_entry->entry_point, got_entry->got_value,
return -1; /*call _dl_exit(1) */
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail) {
+ if (_dl_debug_reloc && _dl_debug_detail) {
_dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_value, reloc_addr);
switch (reloc_type) {
case R_FRV_FUNCDESC_VALUE:
return -1; /*call _dl_exit(1) */
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, reloc_addr->entry_point, reloc_addr);
#endif
return 0;
}
}
#ifdef __SUPPORT_LD_DEBUG__
- if(_dl_debug) {
+ if (_dl_debug) {
_dl_dprintf(_dl_debug_file, "\nINIT/FINI order and dependencies:\n");
for (i = 0; i < nlist; i++) {
struct init_fini_list *tmp;
gid = _dl_getgid();
egid = _dl_getegid();
- if(uid == euid && gid == egid) {
+ if (uid == euid && gid == egid) {
return 1;
}
return 0;
if (unlikely(!symbol_addr && ELF_ST_BIND(sym->st_info) != STB_WEAK)) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
_dl_exit(1);
- };
+ }
}
#if defined (__SUPPORT_LD_DEBUG__)
static const char *_dl_reltypes_tab[] =
{
- [0] "R_MIPS_NONE", "R_MIPS_16", "R_MIPS_32",
- [3] "R_MIPS_REL32", "R_MIPS_26", "R_MIPS_HI16",
- [6] "R_MIPS_LO16", "R_MIPS_GPREL16", "R_MIPS_LITERAL",
- [9] "R_MIPS_GOT16", "R_MIPS_PC16", "R_MIPS_CALL16",
- [12] "R_MIPS_GPREL32",
- [16] "R_MIPS_SHIFT5", "R_MIPS_SHIFT6", "R_MIPS_64",
- [19] "R_MIPS_GOT_DISP", "R_MIPS_GOT_PAGE", "R_MIPS_GOT_OFST",
- [22] "R_MIPS_GOT_HI16", "R_MIPS_GOT_LO16", "R_MIPS_SUB",
- [25] "R_MIPS_INSERT_A", "R_MIPS_INSERT_B", "R_MIPS_DELETE",
- [28] "R_MIPS_HIGHER", "R_MIPS_HIGHEST", "R_MIPS_CALL_HI16",
- [31] "R_MIPS_CALL_LO16", "R_MIPS_SCN_DISP", "R_MIPS_REL16",
- [34] "R_MIPS_ADD_IMMEDIATE", "R_MIPS_PJUMP", "R_MIPS_RELGOT",
- [37] "R_MIPS_JALR",
+ [0] "R_MIPS_NONE", "R_MIPS_16", "R_MIPS_32",
+ [3] "R_MIPS_REL32", "R_MIPS_26", "R_MIPS_HI16",
+ [6] "R_MIPS_LO16", "R_MIPS_GPREL16", "R_MIPS_LITERAL",
+ [9] "R_MIPS_GOT16", "R_MIPS_PC16", "R_MIPS_CALL16",
+ [12] "R_MIPS_GPREL32",
+ [16] "R_MIPS_SHIFT5", "R_MIPS_SHIFT6", "R_MIPS_64",
+ [19] "R_MIPS_GOT_DISP", "R_MIPS_GOT_PAGE", "R_MIPS_GOT_OFST",
+ [22] "R_MIPS_GOT_HI16", "R_MIPS_GOT_LO16", "R_MIPS_SUB",
+ [25] "R_MIPS_INSERT_A", "R_MIPS_INSERT_B", "R_MIPS_DELETE",
+ [28] "R_MIPS_HIGHER", "R_MIPS_HIGHEST", "R_MIPS_CALL_HI16",
+ [31] "R_MIPS_CALL_LO16", "R_MIPS_SCN_DISP", "R_MIPS_REL16",
+ [34] "R_MIPS_ADD_IMMEDIATE", "R_MIPS_PJUMP", "R_MIPS_RELGOT",
+ [37] "R_MIPS_JALR",
};
do { \
if (dpnt->d_tag == DT_MIPS_GOTSYM) \
dynamic[DT_MIPS_GOTSYM_IDX] = dpnt->d_un.d_val; \
-else if(dpnt->d_tag == DT_MIPS_LOCAL_GOTNO) \
+else if (dpnt->d_tag == DT_MIPS_LOCAL_GOTNO) \
dynamic[DT_MIPS_LOCAL_GOTNO_IDX] = dpnt->d_un.d_val; \
-else if(dpnt->d_tag == DT_MIPS_SYMTABNO) \
+else if (dpnt->d_tag == DT_MIPS_SYMTABNO) \
dynamic[DT_MIPS_SYMTABNO_IDX] = dpnt->d_un.d_val; \
else if (dpnt->d_tag == DT_MIPS_RLD_MAP) \
*(Elf32_Addr *)(dpnt->d_un.d_ptr) = (Elf32_Addr) debug_addr; \
if (_dl_debug_bindings)
{
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if (_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr);
}
if (!_dl_debug_nofixups) {
#endif
_dl_exit(1);
}
- };
+ }
- };
+ }
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail && reloc_addr)
+ if (_dl_debug_reloc && _dl_debug_detail && reloc_addr)
_dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n", old_val, *reloc_addr, reloc_addr);
#endif
i = tpnt->dynamic_info[DT_MIPS_SYMTABNO_IDX] - tpnt->dynamic_info[DT_MIPS_GOTSYM_IDX];
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc)
+ if (_dl_debug_reloc)
_dl_dprintf(2, "_dl_perform_mips_global_got_relocations for '%s'\n", tpnt->libname);
#endif
tmp_lazy = lazy && !tpnt->dynamic_info[DT_BIND_NOW];
/* Relocate the global GOT entries for the object */
- while(i--) {
+ while (i--) {
if (sym->st_shndx == SHN_UNDEF) {
if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && sym->st_value && tmp_lazy) {
*got_entry = sym->st_value + (unsigned long) tpnt->loadaddr;
if (unlikely(ELF32_R_TYPE(this_reloc->r_info) != R_PPC_JMP_SLOT)) {
_dl_dprintf(2, "%s: Incorrect relocation type in jump relocation\n", _dl_progname);
_dl_exit(1);
- };
+ }
#endif
/* Address of dump instruction to fix up */
reloc_addr = (Elf32_Addr *) (tpnt->loadaddr + this_reloc->r_offset);
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\n\tResolving symbol %s %x --> ", symname, (Elf32_Addr)reloc_addr);
#endif
if (unlikely(!finaladdr)) {
_dl_dprintf(2, "%s: can't resolve symbol '%s' in lib '%s'.\n", _dl_progname, symname, tpnt->libname);
_dl_exit(1);
- };
+ }
finaladdr += this_reloc->r_addend;
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "%x\n", finaladdr);
#endif
delta = finaladdr - (Elf32_Word)reloc_addr;
}
case R_PPC_COPY:
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_move)
+ if (_dl_debug_move)
_dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
symname, symtab[symtab_index].st_size,
symbol_addr, reloc_addr);
#if 0
{
Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
- if(unlikely(delta<<6>>6 != delta)) {
+ if (unlikely(delta<<6>>6 != delta)) {
_dl_dprintf(2, "%s: symbol '%s' R_PPC_REL24 is out of range.\n\t"
"Compile shared libraries with -fPIC!\n",
_dl_progname, symname);
if (symtab_index)
_dl_dprintf(2, "'%s'\n", symname);
return -1;
- };
+ }
/* instructions were modified */
PPC_DCBST(reloc_addr);
PPC_ISYNC;
out_nocode:
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
#endif
return 0;
if ((unsigned long) got_addr < 0x20000000) {
if (_dl_debug_bindings) {
_dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname);
- if(_dl_debug_detail) _dl_dprintf(_dl_debug_file,
+ if (_dl_debug_detail) _dl_dprintf(_dl_debug_file,
"\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr);
}
}
case R_SH_COPY:
if (symbol_addr) {
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_move)
+ if (_dl_debug_move)
_dl_dprintf(_dl_debug_file,"\n%s move %x bytes from %x to %x",
symname, symtab[symtab_index].st_size,
symbol_addr, reloc_addr);
return -1; /*call _dl_exit(1) */
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
#endif
return -1; /*call _dl_exit(1) */
}
#if defined (__SUPPORT_LD_DEBUG__)
- if(_dl_debug_reloc && _dl_debug_detail)
+ if (_dl_debug_reloc && _dl_debug_detail)
_dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr);
#endif
return 0;
if (unlikely(!symbol_addr && ELF_ST_BIND(sym->st_info) != STB_WEAK)) {
_dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
_dl_exit(1);
- };
+ }
}
#if defined (__SUPPORT_LD_DEBUG__)