diff --git a/core/armelf.x b/core/armelf.x index d38dc1da9..b48477614 100644 --- a/core/armelf.x +++ b/core/armelf.x @@ -93,10 +93,16 @@ SECTIONS .preinit_array : { KEEP (*(.preinit_array)) } PROVIDE (__preinit_array_end = .); PROVIDE (__init_array_start = .); - .init_array : { KEEP (*(.init_array)) } + .init_array : { + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + } PROVIDE (__init_array_end = .); PROVIDE (__fini_array_start = .); - .fini_array : { KEEP (*(.fini_array)) } + .fini_array : { + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + } PROVIDE (__fini_array_end = .); .ctors : { diff --git a/core/armelflib.x b/core/armelflib.x index 0150e02d1..ec7abd5ce 100644 --- a/core/armelflib.x +++ b/core/armelflib.x @@ -59,10 +59,16 @@ SECTIONS .preinit_array : { KEEP (*(.preinit_array)) } PROVIDE (__preinit_array_end = .); PROVIDE (__init_array_start = .); - .init_array : { KEEP (*(.init_array)) } + .init_array : { + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + } PROVIDE (__init_array_end = .); PROVIDE (__fini_array_start = .); - .fini_array : { KEEP (*(.fini_array)) } + .fini_array : { + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + } PROVIDE (__fini_array_end = .); .ctors : {