NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

MIPS TLS relocatoin Issues in rtld



Hi,

I am using NetBSD 3.1 release libraries along with the jemalloc.c file added
in
lib/libc/stdlib.

When i built the library and tested for MIPS arch i could see the problem
below:
- rtld doesnot comeup since the thread specific data
   types "__thread" doesnot get relocated.
- So in the library if __thread symbol is added, rtld
  fails to relocate itself.

It is seen that the execution is aborted at function
_rtld_relocate_nonplt_self () since in the following code snippet

                     ....

        for (; rel < rellim; rel++) {
                where = (void *)(relocbase + rel->r_offset);

                switch (ELF_R_TYPE(rel->r_info)) {
                case R_TYPE(NONE):
                        break;

                case R_TYPE(REL32):
                        assert(ELF_R_SYM(rel->r_info) < gotsym);
                        sym = symtab + ELF_R_SYM(rel->r_info);
                        assert(ELF_ST_BIND(sym->st_info) == STB_LOCAL);
                        store_ptr(where, load_ptr(where) + relocbase);
                        break;

                default:
                        abort(); <=== Here
                }
        }
                ...

The execution aborts at "Here" marked above.

Since the relocation type for __thread symbols is coming as
'R_MIPS_TLS_DTPMOD32'  when checked the object dump using
'readelf' but in the above code  snippet only relocations of type
'R_MIPS_REL32' and 'R_MIPS_NONE' are handled.

For other architecture (ARM,POWERPC,i386) the above problem is not seen,
since symbols of all relocations types are handled in respective
architecture.

Could any one tell why only for MIPS the above switch case to relocate REL
and REL32 relocation types is used.?

The solution is to relocate all the relocation types in
libexec/ld_elf.so/mips_reloc.c file or is there any alternative?


Thanks in Advance,
Channagoud


Home | Main Index | Thread Index | Old Index