authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-16 14:22:32-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-16 14:23:43-04:00
log1cefe1442450961a7960fa3b4b488ae50d5abbef
tree1cb82e0c8263617b780e69695840345b7e90a16e
parentcddd6b46d8ad32f70e0b6c8c6f3192ae4bff9e79
signaturelock-open Commit is signed but in an unrecognized format.

update clone on arm32 to latest musl implementation

See musl commit 05870abeaac0588fb9115cfd11f96880a0af2108 by Rich Felker. Commit message from musl reproduced here: fix code path where child function returns in arm __clone built as thumb mov lr,pc is not a valid way to save the return address in thumb mode since it omits the thumb bit. use a chain of bl and bx to emulate blx. this could be avoided by converting to a .S file with preprocessor conditions to use blx if available, but the time cost here is dominated by the syscall anyway. while making this change, also remove the remnants of support for pre-bx ISA levels. commit 9f290a49bf9ee247d540d3c83875288a7991699c removed the hack from the parent code paths, but left the unnecessary code in the child. keeping it would require rewriting two code paths rather than one, and is useless for reasons described in that commit.

1 files changed, 2 insertions(+), 7 deletions(-)

std/special/c.zig+2-7
......@@ -258,16 +258,11 @@ nakedcc fn clone() void {
258258 \\ bx lr
259259 \\
260260 \\1: mov r0,r6
261 \\ tst r5,#1
262 \\ bne 1f
263 \\ mov lr,pc
264 \\ mov pc,r5
261 \\ bl 3f
265262 \\2: mov r7,#1
266263 \\ svc 0
267 \\
268 \\1: mov lr,pc
269 \\ bx r5
270264 \\ b 2b
265 \\3: bx r5
271266 );
272267 } else {
273268 @compileError("Implement clone() for this arch.");