diff options
author | 2000-11-26 00:12:55 +0000 | |
---|---|---|
committer | 2000-11-26 00:12:55 +0000 | |
commit | 9c4d49cae4b2010c9a5667ad9255f540d7e205db (patch) | |
tree | 1cea87929095161c408f80496d5dd4522320e8f7 /lib | |
parent | Fix some warnings and take advantage of perl5 system defines (diff) | |
download | wireguard-openbsd-9c4d49cae4b2010c9a5667ad9255f540d7e205db.tar.xz wireguard-openbsd-9c4d49cae4b2010c9a5667ad9255f540d7e205db.zip |
Properly implement errno handling for the threaded libc (libc_r)
The powerpc specific code was previously handling system call errors
as if kernel threads existed (currently only userlang threads are modeled).
Thus if multiple threads existed in a process, the process would not
get the correct errno from a system call. This would cause _many_ tests
to fail. Fixing this causes a number of the tests in libc_r/TEST to now work,
that did not before, however a few still fail.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/arch/powerpc/sys/cerror.S | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/libc/arch/powerpc/sys/cerror.S b/lib/libc/arch/powerpc/sys/cerror.S index de7782066bd..49d44fcd4b8 100644 --- a/lib/libc/arch/powerpc/sys/cerror.S +++ b/lib/libc/arch/powerpc/sys/cerror.S @@ -3,39 +3,25 @@ .text ENTRY(cerror) -#if defined(_THREAD_SAFE) || defined (PIC) +#if defined (PIC) stwu 1, -16(1) /* follow the SVR4 ABI */ mflr 3 /* error value is in r0, use r3 */ stw 3, 20(1) #endif + #ifndef PIC -# ifndef _THREAD_SAFE addis 5, 0, errno@H ori 5, 5, errno@L -# else - mr 9, 0 - bl _C_LABEL(__error) - mr 5, 3 - mr 0, 9 -# endif #else -# ifndef _THREAD_SAFE bl _GLOBAL_OFFSET_TABLE_@local-4 mflr 4 lwz 5,_C_LABEL(errno)@got(4) -# else - stw 0, 12(1) - - bl PIC_PLT(_C_LABEL(__error)) - mr 5, 3 - lwz 0, 12(1) -# endif #endif stw 0, 0(5) addi 3, 0, -1 addi 4, 0, -1 -#if defined(_THREAD_SAFE) || defined (PIC) +#if defined (PIC) lwz 0, 20(1) mtlr 0 addi 1, 1, 16 /* follow the SVR4 ABI */ |