Deleted Added
full compact
29c29
< * $FreeBSD: head/libexec/rtld-elf/powerpc/reloc.c 133133 2004-08-04 19:12:14Z dfr $
---
> * $FreeBSD: head/libexec/rtld-elf/powerpc/reloc.c 137122 2004-11-02 09:47:01Z ssouhlal $
208a209,260
> case R_PPC_DTPMOD32:
> def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
> false, cache);
>
> if (def == NULL)
> return (-1);
>
> *where = (Elf_Addr) defobj->tlsindex;
>
> break;
>
> case R_PPC_TPREL32:
> def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
> false, cache);
>
> if (def == NULL)
> return (-1);
>
> /*
> * We lazily allocate offsets for static TLS as we
> * see the first relocation that references the
> * TLS block. This allows us to support (small
> * amounts of) static TLS in dynamically loaded
> * modules. If we run out of space, we generate an
> * error.
> */
> if (!defobj->tls_done) {
> if (!allocate_tls_offset((Obj_Entry*) defobj)) {
> _rtld_error("%s: No space available for static "
> "Thread Local Storage", obj->path);
> return (-1);
> }
> }
>
> *(Elf_Addr **)where = *where * sizeof(Elf_Addr)
> + (Elf_Addr *)(def->st_value + rela->r_addend
> + defobj->tlsoffset - TLS_TP_OFFSET - TLS_TCB_SIZE);
>
> break;
>
> case R_PPC_DTPREL32:
> def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
> false, cache);
>
> if (def == NULL)
> return (-1);
>
> *where += (Elf_Addr)(def->st_value + rela->r_addend
> - TLS_DTV_OFFSET);
>
> break;
>
496a549
> Elf_Addr **_tp;
506c559,566
< tp = (Elf_Addr **) ((char *) allocate_tls(list, 0, 8, 8) + 0x7008);
---
> _tp = (Elf_Addr **) ((char *) allocate_tls(list, 0, 8, 8)
> + TLS_TP_OFFSET + TLS_TCB_SIZE);
>
> /*
> * XXX gcc seems to ignore 'tp = _tp;'
> */
>
> __asm __volatile("mr %0,%1" : "=r"(tp) : "r"(_tp));
515,516c575,578
< p = tls_get_addr_common(tp, ti->ti_module, ti->ti_offset);
< return p + 0x8000;
---
> p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)tp - TLS_TP_OFFSET
> - TLS_TCB_SIZE), ti->ti_module, ti->ti_offset);
>
> return (p + TLS_DTV_OFFSET);