add tlsdesc support for x86_64
This commit is contained in:
parent
5ba238e1e4
commit
39201d07e4
2 changed files with 42 additions and 0 deletions
|
|
@ -25,6 +25,8 @@ static int remap_rel(int type)
|
||||||
return REL_DTPOFF;
|
return REL_DTPOFF;
|
||||||
case R_X86_64_TPOFF64:
|
case R_X86_64_TPOFF64:
|
||||||
return REL_TPOFF;
|
return REL_TPOFF;
|
||||||
|
case R_X86_64_TLSDESC:
|
||||||
|
return REL_TLSDESC;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
40
src/ldso/x86_64/tlsdesc.s
Normal file
40
src/ldso/x86_64/tlsdesc.s
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
.text
|
||||||
|
.global __tlsdesc_static
|
||||||
|
.type __tlsdesc_static,@function
|
||||||
|
__tlsdesc_static:
|
||||||
|
mov 8(%rax),%rax
|
||||||
|
ret
|
||||||
|
|
||||||
|
.global __tlsdesc_dynamic
|
||||||
|
.type __tlsdesc_dynamic,@function
|
||||||
|
__tlsdesc_dynamic:
|
||||||
|
mov 8(%rax),%rax
|
||||||
|
push %rdx
|
||||||
|
mov %fs:8,%rdx
|
||||||
|
push %rcx
|
||||||
|
mov (%rax),%rcx
|
||||||
|
cmp %rcx,(%rdx)
|
||||||
|
jc 1f
|
||||||
|
mov 8(%rax),%rax
|
||||||
|
add (%rdx,%rcx,8),%rax
|
||||||
|
2: pop %rcx
|
||||||
|
sub %fs:0,%rax
|
||||||
|
pop %rdx
|
||||||
|
ret
|
||||||
|
1: push %rdi
|
||||||
|
push %rdi
|
||||||
|
push %rsi
|
||||||
|
push %r8
|
||||||
|
push %r9
|
||||||
|
push %r10
|
||||||
|
push %r11
|
||||||
|
mov %rax,%rdi
|
||||||
|
call __tls_get_addr
|
||||||
|
pop %r11
|
||||||
|
pop %r10
|
||||||
|
pop %r9
|
||||||
|
pop %r8
|
||||||
|
pop %rsi
|
||||||
|
pop %rdi
|
||||||
|
pop %rdi
|
||||||
|
jmp 2b
|
||||||
Loading…
Add table
Add a link
Reference in a new issue