From c92f19c6e81cea0d7cb7224782d5bd8c67b43f3f Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 14 Aug 2016 09:13:44 +0200 Subject: [PATCH] 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. --- src/system/libroot/posix/arch/arm/sigsetjmp.S | 1 + src/system/libroot/posix/arch/m68k/sigsetjmp.S | 1 + src/system/libroot/posix/arch/ppc/sigsetjmp.S | 1 + src/system/libroot/posix/arch/x86/sigsetjmp.S | 1 + src/system/libroot/posix/arch/x86_64/sigsetjmp.S | 1 + 5 files changed, 5 insertions(+) diff --git a/src/system/libroot/posix/arch/arm/sigsetjmp.S b/src/system/libroot/posix/arch/arm/sigsetjmp.S index 74e046d87e..94dadee5de 100644 --- a/src/system/libroot/posix/arch/arm/sigsetjmp.S +++ b/src/system/libroot/posix/arch/arm/sigsetjmp.S @@ -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] diff --git a/src/system/libroot/posix/arch/m68k/sigsetjmp.S b/src/system/libroot/posix/arch/m68k/sigsetjmp.S index 28966dd2f1..7a1f5014e7 100644 --- a/src/system/libroot/posix/arch/m68k/sigsetjmp.S +++ b/src/system/libroot/posix/arch/m68k/sigsetjmp.S @@ -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 */ diff --git a/src/system/libroot/posix/arch/ppc/sigsetjmp.S b/src/system/libroot/posix/arch/ppc/sigsetjmp.S index 8bf45a688a..91585255d1 100644 --- a/src/system/libroot/posix/arch/ppc/sigsetjmp.S +++ b/src/system/libroot/posix/arch/ppc/sigsetjmp.S @@ -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 diff --git a/src/system/libroot/posix/arch/x86/sigsetjmp.S b/src/system/libroot/posix/arch/x86/sigsetjmp.S index 9498135ea3..2016cbe700 100644 --- a/src/system/libroot/posix/arch/x86/sigsetjmp.S +++ b/src/system/libroot/posix/arch/x86/sigsetjmp.S @@ -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 diff --git a/src/system/libroot/posix/arch/x86_64/sigsetjmp.S b/src/system/libroot/posix/arch/x86_64/sigsetjmp.S index 70866974dc..16974c2b2e 100644 --- a/src/system/libroot/posix/arch/x86_64/sigsetjmp.S +++ b/src/system/libroot/posix/arch/x86_64/sigsetjmp.S @@ -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