Add stubs for TLS.
Arbitraly choose the 2nd variant until I figure out which one I should use.
This commit is contained in:
parent
eed605e0fe
commit
9ac88d19dc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135680
@ -90,13 +90,11 @@ _rtld_relocate_nonplt_self(Elf_Dyn *dynp, Elf_Addr relocbase)
|
||||
}
|
||||
rellim = (const Elf_Rel *)((caddr_t)rel + relsz);
|
||||
size = (rellim - 1)->r_offset - rel->r_offset;
|
||||
mprotect((void*)relocbase, size, PROT_READ|PROT_WRITE|PROT_EXEC);
|
||||
for (; rel < rellim; rel++) {
|
||||
where = (Elf_Addr *)(relocbase + rel->r_offset);
|
||||
|
||||
*where += (Elf_Addr)relocbase;
|
||||
}
|
||||
mprotect((void*)relocbase, size, PROT_READ|PROT_EXEC);
|
||||
}
|
||||
/*
|
||||
* It is possible for the compiler to emit relocations for unaligned data.
|
||||
@ -339,3 +337,14 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj,
|
||||
return target;
|
||||
}
|
||||
|
||||
void
|
||||
allocate_initial_tls(Obj_Entry *objs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void *
|
||||
__tls_get_addr(tls_index* ti)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -37,14 +37,8 @@
|
||||
struct Struct_Obj_Entry;
|
||||
|
||||
/* Return the address of the .dynamic section in the dynamic linker. */
|
||||
#if 0
|
||||
#define rtld_dynamic(obj) \
|
||||
((const Elf_Dyn *)((obj)->relocbase + (Elf_Addr)&_DYNAMIC))
|
||||
#endif
|
||||
#if 0
|
||||
#define rtld_dynamic(obj) (&_DYNAMIC)
|
||||
#endif
|
||||
#define rtld_dynamic(obj) (const Elf_Dyn *)((obj)->relocbase)
|
||||
|
||||
Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
|
||||
const struct Struct_Obj_Entry *defobj,
|
||||
const struct Struct_Obj_Entry *obj,
|
||||
@ -55,10 +49,25 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
|
||||
|
||||
#define call_initfini_pointer(obj, target) \
|
||||
(((InitFunc)(target))())
|
||||
|
||||
typedef struct {
|
||||
unsigned long ti_module;
|
||||
unsigned long ti_offset;
|
||||
} tls_index;
|
||||
|
||||
#define round(size, align) \
|
||||
(((size) + (align) - 1) & ~((align) - 1))
|
||||
#define calculate_first_tls_offset(size, align) \
|
||||
round(size, align)
|
||||
#define calculate_tls_offset(prev_offset, prev_size, size, align) \
|
||||
round(prev_offset + prev_size, align)
|
||||
#define calculate_tls_end(off, size) ((off) + (size))
|
||||
|
||||
|
||||
/*
|
||||
* Lazy binding entry point, called via PLT.
|
||||
*/
|
||||
void _rtld_bind_start(void);
|
||||
|
||||
extern void *__tls_get_addr(tls_index *ti);
|
||||
#endif
|
||||
|
@ -60,17 +60,14 @@ __FBSDID("$FreeBSD$");
|
||||
bl _rtld_relocate_nonplt_self
|
||||
mov r1, sp
|
||||
add r2, sp, #4
|
||||
mov r0, r6 /* sp */
|
||||
mov r0, r6 /* sp */
|
||||
bl _rtld /* call the shared loader */
|
||||
mov r3, r0 /* save entry point */
|
||||
|
||||
ldr r1, [sp, #0] /* r2 = cleanup */
|
||||
ldr r0, [sp, #4] /* r1 = obj_main */
|
||||
ldr r2, [sp, #0] /* r2 = cleanup */
|
||||
ldr r1, [sp, #4] /* r1 = obj_main */
|
||||
add sp, sp, #8 /* restore stack */
|
||||
#if 0
|
||||
mov r0, r4 /* restore ps_strings */
|
||||
#endif
|
||||
mov r2, #0
|
||||
mov pc, r3 /* jump to the entry point */
|
||||
.L2:
|
||||
.word _GLOBAL_OFFSET_TABLE_ - (.L1+8)
|
||||
|
@ -2607,7 +2607,8 @@ free_tls(void *tls, size_t tcbsize, size_t tcbalign)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__)
|
||||
#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \
|
||||
defined(__arm__)
|
||||
|
||||
/*
|
||||
* Allocate Static TLS using the Variant II method.
|
||||
|
Loading…
Reference in New Issue
Block a user