Implemented support for thread-local storage

This commit is contained in:
2021-12-23 16:41:53 +00:00
parent bb582e96de
commit ec31b208ab
2 changed files with 14 additions and 2 deletions

View File

@@ -3,13 +3,14 @@
#include <sys/_errno.h> #include <sys/_errno.h>
#define errno (*__errno_location()) #define errno (__get_errno())
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
extern int *__errno_location(void); extern void __set_errno(int v);
extern int __get_errno(void);
#if defined(__cplusplus) #if defined(__cplusplus)
} }

View File

@@ -0,0 +1,11 @@
.global pthread_self
.type pthread_self, @function
pthread_self:
push %rbp
mov %rsp, %rbp
mov %fs:0, %rax
pop %rbp
ret