How to collect data from different .a files into one array? How to keep sections in .a files with ld script?

Up vote 1 down vote favorite share g+ share fb share tw.

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 array_size = __my_mega_array_end - __my_mega_array_begin; So anyone can link his code with my code, and my code will know about data in his code.

Ok, it works, but not actually... The problem is that KEEP directive works completely with . O files, but not . A .

If no sections is used in particullar . O file inside of . A file, then whole .

O file will be discarded from linking even though KEEP directive is used. Using of --whole-arhive option to ld will help, but I'm not allowed to use this option for some reasons. I should do all with ld script file only... Another way to solve problem is to use partial linking, by creating relocatable file.

So all . O files inside of . A will linked to one .

O file. But I'm not allowed to use partial linking either. So I should do it only by using ld script and using .

A file. C linker elf ld . A link|improve this question edited Jul 4 '11 at 8:37 asked Jul 4 '11 at 8:06Anton62.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions