Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-05-13 14:44:13 +0300
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-05-18 08:45:09 +0300
commit2faeaf50fd3e83a8573d6008f3e927c1d40c3b4a (patch)
treee86a3f2d6f349d74c111aac37dbfafeacf723dfe /libgloss
parent9035e406cbda2dcab02dde1c6bd7db0a6f6f1563 (diff)
Use global atexit data for all configurations
For the exit processing only members of _GLOBAL_REENT were used by default. If the _REENT_GLOBAL_ATEXIT option was enabled, then the data structures were provided through dedicated global objects. Make this option the default. Remove the option. Rename struct _reent members _atexit and _atexit0 to _reserved_6 and _reserved_7, respectively. Provide them only if _REENT_BACKWARD_BINARY_COMPAT is defined.
Diffstat (limited to 'libgloss')
-rw-r--r--libgloss/arc/crt0.S11
-rw-r--r--libgloss/epiphany/crt0.S26
-rw-r--r--libgloss/sparc_leon/locore_atexit.c4
3 files changed, 19 insertions, 22 deletions
diff --git a/libgloss/arc/crt0.S b/libgloss/arc/crt0.S
index 46c9efd71..8d9adaa52 100644
--- a/libgloss/arc/crt0.S
+++ b/libgloss/arc/crt0.S
@@ -187,12 +187,13 @@ __start:
; calling atexit drags in malloc, so instead poke the function
; address directly into the reent structure
ld r1, [gp, @_impure_ptr@sda]
- mov_s r0, @_fini
- add r1, r1, 0x14c ; &_GLOBAL_REENT->atexit0
- st r1, [r1, -4] ; _GLOBAL_REENT->atexit
- st_s r0, [r1, 8] ; _GLOBAL_REENT->atexit0._fns[0]
+ mov_s r1, @__atexit0
+ mov_s r2, @__atexit
+ st_s r1, [r2, 0] ; __atexit = &__atexit0
mov_s r0, 1
- st_s r0, [r1, 4] ; _GLOBAL_REENT->atexit0._ind
+ st_s r0, [r1, 4] ; __atexit0._ind = 1
+ mov_s r0, @_fini
+ st_s r0, [r1, 8] ; __atexit0._fns[0] = _fini
; branch to _init
#if defined (__ARCEM__) || defined (__ARCHS__)
jl @_init
diff --git a/libgloss/epiphany/crt0.S b/libgloss/epiphany/crt0.S
index d684e1e10..b0d9ecbab 100644
--- a/libgloss/epiphany/crt0.S
+++ b/libgloss/epiphany/crt0.S
@@ -113,23 +113,19 @@ _external_start:
#else
; calling atexit drags in malloc, so instead poke the function
; address directly into the reent structure
- mov r2,%low(__impure_ptr)
- movt r2,%high(__impure_ptr)
- ldr r2,[r2]
- mov r1,%low(fini)
- movt r1,%high(fini)
+ mov r1,%low(__atexit0)
+ movt r1,%high(__atexit0)
+ mov r2,%low(__atexit)
+ movt r2,%high(__atexit)
#ifdef __STRUCT_ALIGN_64__
-#error
- add r2,r2,need_to_find_out; &_GLOBAL_REENT->atexit0
- str r2, [r2,-1];??or -2?; _GLOBAL_REENT->atexit
- mov r0, 1
- str r0, [r2,1] ; _GLOBAL_REENT->atexit0._ind
- str r1, [r2,2] ; _GLOBAL_REENT->atexit0._fns[0]
+#error "not implemented"
#else /* !__STRUCT_ALIGN_64__ */
- add r0,r2,0x14c ; &_GLOBAL_REENT->atexit0
- str r0, [r0,-1] ; _GLOBAL_REENT->atexit
- mov r0, 1
- strd r0, [r2,0x2a] ; _GLOBAL_REENT->atexit0._ind
+ str r1, [r2, 0] ; __atexit = &__atexit0
+ movr r0, 1
+ str r0, [r1, 4] ; __atexit0._ind = 1
+ mov r0,%low(fini)
+ movt r0,%high(fini)
+ str r0, [r1, 8] ; __atexit0._fns[0] = fini
#endif /* !__STRUCT_ALIGN_64__ */
#endif /* !0 */
;; Call global and static constructors
diff --git a/libgloss/sparc_leon/locore_atexit.c b/libgloss/sparc_leon/locore_atexit.c
index b23054c77..e3e6df12f 100644
--- a/libgloss/sparc_leon/locore_atexit.c
+++ b/libgloss/sparc_leon/locore_atexit.c
@@ -37,9 +37,9 @@ atexit (void (*fn) (void))
{
register struct _atexit *p;
- p = _GLOBAL_REENT->_atexit;
+ p = __atexit;
if (p == NULL)
- _GLOBAL_REENT->_atexit = p = &_GLOBAL_REENT->_atexit0;
+ __atexit = p = &__atexit0;
if (p->_ind >= _ATEXIT_SIZE)
{
return -1;