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/ _______________________________________________ AVR-libc-dev mailing list AVR-libc-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-libc-dev