avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [patch #8556] Fix atexit.c


From: Georg-Johann Lay
Subject: [avr-libc-dev] [patch #8556] Fix atexit.c
Date: Tue, 14 Oct 2014 11:40:08 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28

URL:
  <http://savannah.nongnu.org/patch/?8556>

                 Summary: Fix atexit.c
                 Project: AVR C Runtime Library
            Submitted by: gjlayde
            Submitted on: Di 14 Okt 2014 11:40:07 GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

This patch fixes several atexit issues:

* Issuance of calls to functions as registered by atexit() is located in
section .fini6a. As the current linker description does not handle that
section it's treated as orphan and located conflicting with other sections:


$ avr-gcc main.c -mmcu=atmega128

$INSTALL/lib/gcc/avr/$VERSION/../../../../avr/bin/ld: section .fini6a loaded
at [00000390,000003b7] overlaps section .data loaded at [00000390,00000395]

collect2: error: ld returned 1 exit status


The patch moves that code to .fini7 so that atexit functions are sequenced
before static destructors which is closest to C++ spec.

* __atexit_fini is not naked thus will crash the program as it is returning.

* In order to arrange the hypothetical case that the code generated by
atexit_fini would need a frame it's now in a proper (non-naked) function
called by now naked atexit_fini.

* Except atexit, nothing in atexit.c needs to be global --> make static.

Even though atexit is exotic in non-hosted contexts it's nice to see it
working, e.g. to reduce testsuite fallout.



Cf. also

http://lists.nongnu.org/archive/html/avr-gcc-list/2014-10/msg00020.html



        * libc/stdlib/atexit.c (__atexit_fini): Rename to...
        (atexit_fini): ...this.  Make static, naked, and used.
        Move to section .fini7.  Outsource worker code to...
        (atexit_finido): ...this new function.
        (atexit_p): Renamed from __atexit_p.  Make static.






    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Di 14 Okt 2014 11:40:07 GMT  Name: atexit.diff  Size: 1kB   By: gjlayde
patch to fix atexit.c issues
<http://savannah.nongnu.org/patch/download.php?file_id=32269>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8556>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]