How to collect data from different .a files into one array? How to keep sections in .a files with ld script?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I need to collect some data from different .a files to one array. I do it by collecting data to one section first .c file TArElement __attribute__ (( section ( ".my.special.section" ))) uwiveuve = { ... second .c file TArElement __attribute__ (( section ( ".my.special.section" ))) egwegwxb = { ... etc. in ld script __my_mega_array_begin = ABSOLUTE (.); KEEP (*(. my . special . section )) __my_mega_array_end = ABSOLUTE (.); in main .c file extern TArElement * __my_mega_array_begin extern TArElement * __my_mega_array_end const t_size