zig/lib/tsan/tsan_rtl_mips64.S
Andrew Kelley 8219d92987 stage2: fix Cache deadlock and build more of TSAN
* rename is_compiler_rt_or_libc to skip_linker_dependencies
   and set it to `true` for all sub-Compilations. I believe
   this resolves the deadlock we were experiencing on Drone
   CI and on some users' computers. I will remove the CI workaround in
   a follow-up commit.
 * enabling TSAN automatically causes the Compilation to link against
   libc++ even if not requested, because TSAN depends on libc++.
 * add -fno-rtti flags where appropriate when building TSAN objects.
   Thanks Firefox317 for pointing this out.
 * TSAN support: resolve all the undefined symbols. We are still seeing
   a dependency on __gcc_personality_v0 but will resolve this one in a
   follow-up commit.
 * static libs do not try to build libc++ or libc++abi.
2020-12-24 01:18:48 -07:00

215 lines
3.7 KiB
ArmAsm
Vendored

.section .text
.set noreorder
.hidden __tsan_setjmp
.comm _ZN14__interception11real_setjmpE,8,8
.globl setjmp
.type setjmp, @function
setjmp:
// save env parameters
daddiu $sp,$sp,-40
sd $s0,32($sp)
sd $ra,24($sp)
sd $fp,16($sp)
sd $gp,8($sp)
// calculate and save pointer to GOT
lui $gp,%hi(%neg(%gp_rel(setjmp)))
daddu $gp,$gp,$t9
daddiu $gp,$gp,%lo(%neg(%gp_rel(setjmp)))
move $s0,$gp
// save jmp_buf
sd $a0,0($sp)
// obtain $sp
dadd $a0,$zero,$sp
// call tsan interceptor
jal __tsan_setjmp
daddiu $a1,$a0,40
// restore jmp_buf
ld $a0,0($sp)
// restore gp
move $gp,$s0
// load pointer of libc setjmp to t9
dla $t9,(_ZN14__interception11real_setjmpE)
// restore env parameters
ld $gp,8($sp)
ld $fp,16($sp)
ld $ra,24($sp)
ld $s0,32($sp)
daddiu $sp,$sp,40
// tail jump to libc setjmp
ld $t9,0($t9)
jr $t9
nop
.size setjmp, .-setjmp
.hidden __tsan_setjmp
.globl _setjmp
.comm _ZN14__interception12real__setjmpE,8,8
.type _setjmp, @function
_setjmp:
// Save env parameters
daddiu $sp,$sp,-40
sd $s0,32($sp)
sd $ra,24($sp)
sd $fp,16($sp)
sd $gp,8($sp)
// calculate and save pointer to GOT
lui $gp,%hi(%neg(%gp_rel(_setjmp)))
daddu $gp,$gp,$t9
daddiu $gp,$gp,%lo(%neg(%gp_rel(_setjmp)))
move $s0,$gp
// save jmp_buf
sd $a0,0($sp)
// obtain $sp
dadd $a0,$zero,$sp
// call tsan interceptor
jal __tsan_setjmp
daddiu $a1,$a0,40
// restore jmp_buf
ld $a0,0($sp)
// restore gp
move $gp,$s0
// load pointer of libc _setjmp to t9
dla $t9,(_ZN14__interception12real__setjmpE)
// restore env parameters
ld $gp,8($sp)
ld $fp,16($sp)
ld $ra,24($sp)
ld $s0,32($sp)
daddiu $sp,$sp,40
// tail jump to libc _setjmp
ld $t9,0($t9)
jr $t9
nop
.size _setjmp, .-_setjmp
.hidden __tsan_setjmp
.globl sigsetjmp
.comm _ZN14__interception14real_sigsetjmpE,8,8
.type sigsetjmp, @function
sigsetjmp:
// Save env parameters
daddiu $sp,$sp,-48
sd $s0,40($sp)
sd $ra,32($sp)
sd $fp,24($sp)
sd $gp,16($sp)
// calculate and save pointer to GOT
lui $gp,%hi(%neg(%gp_rel(sigsetjmp)))
daddu $gp,$gp,$t9
daddiu $gp,$gp,%lo(%neg(%gp_rel(sigsetjmp)))
move $s0,$gp
// save jmp_buf and savesig
sd $a0,0($sp)
sd $a1,8($sp)
// obtain $sp
dadd $a0,$zero,$sp
// call tsan interceptor
jal __tsan_setjmp
daddiu $a1,$a0,48
// restore jmp_buf and savesig
ld $a0,0($sp)
ld $a1,8($sp)
// restore gp
move $gp,$s0
// load pointer of libc sigsetjmp to t9
dla $t9,(_ZN14__interception14real_sigsetjmpE)
// restore env parameters
ld $gp,16($sp)
ld $fp,24($sp)
ld $ra,32($sp)
ld $s0,40($sp)
daddiu $sp,$sp,48
// tail jump to libc sigsetjmp
ld $t9,0($t9)
jr $t9
nop
.size sigsetjmp, .-sigsetjmp
.hidden __tsan_setjmp
.comm _ZN14__interception16real___sigsetjmpE,8,8
.globl __sigsetjmp
.type __sigsetjmp, @function
__sigsetjmp:
// Save env parameters
daddiu $sp,$sp,-48
sd $s0,40($sp)
sd $ra,32($sp)
sd $fp,24($sp)
sd $gp,16($sp)
// calculate and save pointer to GOT
lui $gp,%hi(%neg(%gp_rel(__sigsetjmp)))
daddu $gp,$gp,$t9
daddiu $gp,$gp,%lo(%neg(%gp_rel(__sigsetjmp)))
move $s0,$gp
// save jmp_buf and savesig
sd $a0,0($sp)
sd $a1,8($sp)
// obtain $sp
dadd $a0,$zero,$sp
// call tsan interceptor
jal __tsan_setjmp
daddiu $a1,$a0,48
// restore jmp_buf and savesig
ld $a0,0($sp)
ld $a1,8($sp)
// restore gp
move $gp,$s0
// load pointer to libc __sigsetjmp in t9
dla $t9,(_ZN14__interception16real___sigsetjmpE)
// restore env parameters
ld $gp,16($sp)
ld $fp,24($sp)
ld $ra,32($sp)
ld $s0,40($sp)
daddiu $sp,$sp,48
// tail jump to libc __sigsetjmp
ld $t9,0($t9)
jr $t9
nop
.size __sigsetjmp, .-__sigsetjmp