mbv: global constructors ish
This commit is contained in:
parent
e7b38fb560
commit
2e640690ba
@ -21,6 +21,13 @@ SECTIONS
|
|||||||
*(.rodata*)
|
*(.rodata*)
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
|
.init :
|
||||||
|
{
|
||||||
|
__init_array_start = .;
|
||||||
|
KEEP(*(.init_array*))
|
||||||
|
__init_array_end = .;
|
||||||
|
}
|
||||||
|
|
||||||
.bss (NOLOAD) :
|
.bss (NOLOAD) :
|
||||||
{
|
{
|
||||||
_bss_begin = .;
|
_bss_begin = .;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
extern "C" uint32_t _bss_begin, _bss_end, _initial_stack_pointer;
|
extern "C" uint32_t _bss_begin, _bss_end, _initial_stack_pointer;
|
||||||
extern "C" int main();
|
extern "C" int main();
|
||||||
|
extern "C" void __libc_init_array();
|
||||||
|
|
||||||
__attribute__((section(".start"), used, naked)) void _start() {
|
__attribute__((section(".start"), used, naked)) void _start() {
|
||||||
// clear .bss
|
// clear .bss
|
||||||
@ -11,6 +12,8 @@ __attribute__((section(".start"), used, naked)) void _start() {
|
|||||||
|
|
||||||
asm volatile("la sp, _initial_stack_pointer");
|
asm volatile("la sp, _initial_stack_pointer");
|
||||||
|
|
||||||
|
__libc_init_array();
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Loading…
Reference in New Issue
Block a user