diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-05-13 13:44:13 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-05-18 07:45:09 +0200 |
commit | 2faeaf50fd3e83a8573d6008f3e927c1d40c3b4a (patch) | |
tree | e86a3f2d6f349d74c111aac37dbfafeacf723dfe /libgloss | |
parent | 9035e406cbda2dcab02dde1c6bd7db0a6f6f1563 (diff) | |
download | newlib-2faeaf50fd3e83a8573d6008f3e927c1d40c3b4a.zip newlib-2faeaf50fd3e83a8573d6008f3e927c1d40c3b4a.tar.gz newlib-2faeaf50fd3e83a8573d6008f3e927c1d40c3b4a.tar.bz2 |
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.S | 11 | ||||
-rw-r--r-- | libgloss/epiphany/crt0.S | 26 | ||||
-rw-r--r-- | libgloss/sparc_leon/locore_atexit.c | 4 |
3 files changed, 19 insertions, 22 deletions
diff --git a/libgloss/arc/crt0.S b/libgloss/arc/crt0.S index 46c9efd..8d9adaa 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 d684e1e..b0d9ecb 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 b23054c..e3e6df1 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; |