[arch] fix link script not include global array init

Using wild match init_array* to include global array init ctor

Before:

 10 .ctors             00000040 ffff0000001e6b80 00000000401e6b80 DATA
 11 .dtors             00000000 ffff0000001e6bc0 00000000401e6bc0 DATA
 12 .got               00000060 ffff0000001e6bc0 00000000401e6bc0 DATA
 13 .init_array.1      00000470 ffff0000001e6c20 00000000401e6c20
 14 .fini_array.1      00000470 ffff0000001e7090 00000000401e7090
 15 .dummy_post_data   00000000 ffff0000001e7500 00000000401e7500 DATA
 16 .bss               00009460 ffff0000001e8000 00000000401e8000 BSS

After:

 10 .ctors             000004b0 ffff0000001e6b80 00000000401e6b80 DATA
 11 .dtors             00000470 ffff0000001e7030 00000000401e7030
 12 .got               00000060 ffff0000001e74a0 00000000401e74a0 DATA
 13 .dummy_post_data   00000000 ffff0000001e7500 00000000401e7500 DATA
 14 .bss               00009460 ffff0000001e8000 00000000401e8000 BSS

Signed-off-by: Lei Wen <leiwen@asrmicro.com>
This commit is contained in:
Lei Wen
2025-09-26 20:17:15 +08:00
committed by Travis Geiselbrecht
parent 63e4bdcd92
commit 145e9a0d27
11 changed files with 22 additions and 22 deletions

View File

@@ -59,12 +59,12 @@ SECTIONS
.ctors : ALIGN(4) {
__ctor_list = .;
KEEP(*(.ctors .init_array))
KEEP(*(.ctors .init_array*))
__ctor_end = .;
}
.dtors : ALIGN(4) {
__dtor_list = .;
KEEP(*(.dtors .fini_array))
KEEP(*(.dtors .fini_array*))
__dtor_end = .;
}

View File

@@ -59,12 +59,12 @@ SECTIONS
.ctors : ALIGN(4) {
__ctor_list = .;
KEEP(*(.ctors .init_array))
KEEP(*(.ctors .init_array*))
__ctor_end = .;
}
.dtors : ALIGN(4) {
__dtor_list = .;
KEEP(*(.dtors .fini_array))
KEEP(*(.dtors .fini_array*))
__dtor_end = .;
}