Hi Rich,
Thanks for Your mail
I have ported musl for mips64 arch from porting guide.the list includes crt_arch.h and Now I didn't place crt assembly files for mips64 arch.
> That produces a relocation in the elf32 encoding, because I just
> assumes mips is elf32 when I wrote it. I believe the 64-bit version
> should be:
>
> rel[1] = sym-p->syms << 32 | R_MIPS_JUMP_SLOT;
this change resolved some of the relocation type errors but still i am getting some relocation type errors.I think these errors are from do_relocs()
Error relocating libc.so: unsupported relocation type 4611
Error relocating libc.so: unsupported relocation type 4611
Error relocating libc.so: unsupported relocation type 4611
Error relocating libc.so: unsupported relocation type 4611
Error relocating libc.so: unsupported relocation type 4611
Error relocating libc.so: unsupported relocation type 4611
;
;
Error relocating libc.so: unsupported relocation type 4611
the relocation type value is 4611 for all the errors.
> Did you make a reloc.h defining the relocation types needed for mips
> n64 and mapping them to the generic-reloc names musl uses for them?
> See the existing arch/*/reloc.h files. Without these being defined
> directly the dynamic linker will not be able to process the
> relocations it finds in itself or in the main program or other
> libraries
I have ported reloc.h for mips64 as
bash-3.2$ cat arch/mips64/reloc.h
#include <endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define ENDIAN_SUFFIX "el"
#else
#define ENDIAN_SUFFIX ""
#endif
#ifdef __mips64_soft_float
#define FP_SUFFIX "-sf"
#else
#define FP_SUFFIX ""
#endif
#define LDSO_ARCH "mips64" ENDIAN_SUFFIX FP_SUFFIX
#define TPOFF_K (-0x7000)
#define REL_SYM_OR_REL R_MIPS_64 /*I didn't see R_MIPS_REL64 so It is a composition of R_MIPS_64 and R_MIPS_REL relocations but i didn't see R_MIPS_REL in elf.h.
how can i define REL_SYM_OR_REL for mips n64 abi */
#define REL_PLT R_MIPS_JUMP_SLOT
#define REL_COPY R_MIPS_COPY
#define REL_DTPMOD R_MIPS_TLS_DTPMOD64
#define REL_DTPOFF R_MIPS_TLS_DTPREL64
#define REL_TPOFF R_MIPS_TLS_TPREL64
;
;
#define CRTJMP(pc,sp) __asm__ __volatile__( \
"move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) /* JR Rs means jump register PC <- Rs ,jump to the address in the rs*/
#define GETFUNCSYM(fp, sym, got) __asm__ ( \
".hidden " #sym "\n" \
".set push \n" \
".set noreorder \n" \
" bal 1f \n" \
" nop \n" \
" .gpdword . \n" \
" .gpdword " #sym " \n" \
"1: ld %0, ($ra) \n" \
" dsubu %0, $ra, %0 \n" \
" ld $ra, 8($ra) \n" \
" daddu %0, %0, $ra \n" \
".set pop \n" \
: "=r"(*(fp)) : : "memory", "ra" )
Thanks,
Mahesh