libc/arm64: work arround linker bug for cas()
at the _cas0 label, the linker would generate spurious stack adjustment before the return: atexitdont+0x84 0x000000000003614c CLREX $0xf atexitdont+0x88 0x0000000000036150 MOVW R31,R0 atexitdont+0x8c 0x0000000000036154 MOV (SP)16!,R30 <- ???????????? atexitdont+0x90 0x0000000000036158 RETURN the work arround is to move the code into its own cas0 text symbol. this fixes impossible cwfs crashes in srvi().
This commit is contained in:
parent
b599dc0e54
commit
0002fd0cf7
2 changed files with 7 additions and 4 deletions
|
@ -3,6 +3,12 @@
|
|||
* int cas(uint *p, int ov, int nv);
|
||||
* int casl(ulong *p, ulong ov, ulong nv);
|
||||
*/
|
||||
TEXT cas0(SB), 1, $-4
|
||||
_cas0:
|
||||
CLREX
|
||||
MOVW $0, R0
|
||||
RETURN
|
||||
|
||||
TEXT cas32(SB), 1, $-4
|
||||
TEXT cas(SB), 1, $-4
|
||||
TEXT casl(SB), 1, $-4
|
||||
|
@ -16,10 +22,6 @@ _cas1:
|
|||
CBNZ R4, _cas1
|
||||
MOVW $1, R0
|
||||
B _barrier(SB)
|
||||
_cas0:
|
||||
CLREX
|
||||
MOVW $0, R0
|
||||
RETURN
|
||||
|
||||
TEXT casp(SB), 1, $-4
|
||||
MOV ov+8(FP), R1
|
||||
|
|
|
@ -5,6 +5,7 @@ _tas1:
|
|||
STXRW R2, (R0), R3
|
||||
CBNZ R3, _tas1
|
||||
MOVW R1, R0
|
||||
B _barrier(SB)
|
||||
|
||||
TEXT _barrier(SB), 1, $-4
|
||||
DMB $0xB // ISH
|
||||
|
|
Loading…
Reference in a new issue