From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67420 invoked by alias); 5 Aug 2019 12:02:16 -0000 Mailing-List: contact newlib-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-cvs-owner@sourceware.org Received: (qmail 67332 invoked by uid 9007); 5 Aug 2019 12:02:15 -0000 Date: Mon, 05 Aug 2019 12:02:00 -0000 Message-ID: <20190805120215.67330.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Richard Earnshaw To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Align libgloss/arm and libc/sys/arm sources: Lite exit support X-Act-Checkin: newlib-cygwin X-Git-Author: Alexander Fedotov X-Git-Refname: refs/heads/master X-Git-Oldrev: dfffe683038357d106893ef1ba30462b31e7b589 X-Git-Newrev: bd5596f4fdd8d08966f03057316c1baea754ae4c X-SW-Source: 2019-q3/txt/msg00015.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=bd5596f4fdd8d08966f03057316c1baea754ae4c commit bd5596f4fdd8d08966f03057316c1baea754ae4c Author: Alexander Fedotov Date: Fri Aug 2 07:33:45 2019 -0500 Align libgloss/arm and libc/sys/arm sources: Lite exit support Applied changes from commit 2404223: * arm/crt0.S (_mainCRTStartup): Weak reference to atexit and _fini when lite exit is enabled. Diff: --- newlib/libc/sys/arm/crt0.S | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S index a55aa36..5e677a2 100644 --- a/newlib/libc/sys/arm/crt0.S +++ b/newlib/libc/sys/arm/crt0.S @@ -518,8 +518,17 @@ __change_mode: for _fini to be called at program exit. */ movs r4, r0 movs r5, r1 +#ifdef _LITE_EXIT + /* Make reference to atexit weak to avoid unconditionally pulling in + support code. Refer to comments in __atexit.c for more details. */ + .weak FUNCTION(atexit) + ldr r0, .Latexit + cmp r0, #0 + beq .Lweak_atexit +#endif ldr r0, .Lfini bl FUNCTION (atexit) +.Lweak_atexit: bl FUNCTION (_init) movs r0, r4 movs r1, r5 @@ -589,6 +598,13 @@ change_back: .LC2: .word __bss_end__ #ifdef __USES_INITFINI__ +#ifdef _LITE_EXIT +.Latexit: + .word FUNCTION(atexit) + + /* Weak reference _fini in case of lite exit. */ + .weak FUNCTION(_fini) +#endif .Lfini: .word FUNCTION(_fini) #endif