Fix definition of _setjmp

The #pragma weak does not work, the symbol is not defined and when
already defined, it is not made weak. Moreover, it does not make the
symbol global so we need to declare it with a FUNCTION.

If we want the symbol to be weak, then we should use .weak to do so. The
_longjmp symbol should also be changed to match, in that case.

Fixes #12912.
This commit is contained in:
Adrien Destugues
2016-08-14 09:18:07 +02:00
parent 8471ec3d56
commit c92f19c6e8
5 changed files with 5 additions and 0 deletions
@@ -19,6 +19,7 @@ FUNCTION_END(__sigsetjmp)
/* int setjmp(jmp_buf buffer) */
FUNCTION(setjmp):
FUNCTION(_setjmp):
stmia r0, {r0-r14}
mrs r1, cpsr
str r1, [r0, #64]
@@ -33,6 +33,7 @@ FUNCTION_END(sigsetjmp)
/* int setjmp(jmp_buf buffer) */
FUNCTION(setjmp):
FUNCTION(_setjmp):
move.l (%a7)+,%a0
move.l (%a7)+,%d0
clr.l -(%a7) /* push 0 as 2nd arg */
@@ -44,6 +44,7 @@ FUNCTION(sigsetjmp):
/* int setjmp(jmp_buf buffer) */
FUNCTION(setjmp):
FUNCTION(_setjmp):
// call __sigsetjmp with saveMask = 0
addi %r4, 0, 0
b __sigsetjmp
@@ -43,6 +43,7 @@ FUNCTION_END(sigsetjmp)
/* int setjmp(jmp_buf buffer) */
FUNCTION(setjmp):
FUNCTION(_setjmp):
// prepare %edx, %ecx, and %eax for sigsetjmp
mov 0(%esp), %edx
lea 4(%esp), %ecx
@@ -30,6 +30,7 @@ FUNCTION_END(setjmp)
/* int setjmp(jmp_buf buffer) */
FUNCTION(setjmp):
FUNCTION(_setjmp):
// Jump to sigsetjmp with a zero saveMask.
xorl %esi, %esi
jmp sigsetjmp@PLT