This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Specify section for whole .a static library


Ok. Next information.

SECTIONS {
 .foo { slibrary.a(.text) }
}

works when -Tskript.ld option is specified AFTER the input files eg.
gcc -o prog.exe a.o b.o -Tlinker.ld

when it is before (gcc -Tlinker.ld -o prog.exe a.o b.o), symbols from
slibrary.a won't be found.

If I specify the object files in linker scripts, e.g.

SECTIONS {
 .foo { s*.o(.text) }
}

linking works without regard to -T position on command line.

The same situation occurs for INPUT, GROUP, ... commands.

Is this expected behaviour?

regards
Jan

2011/4/6 Jan Pohanka <xhpohanka@gmail.com>:
> I forget to mention the background. The project runs on arm9 processor
> compiled with gcc 4.4.5 with binutils 2.21. I have tested the same
> steps on pc using mingw (binutils 2.20) and there following syntax
> works fine
>
> SECTIONS {
> ?.foo { slibrary.a(.text) }
> ?}
>
> But why this is not possible for arm-elf target?
>
> regards
> Jan
>
> 2011/4/6 Jan Pohanka <xhpohanka@gmail.com>:
>> Hello,
>>
>> I can use linker script capabilities to put the contents of any
>> sections from a file to another one using following syntax
>>
>> SECTIONS {
>> ?.foo { file.o(.text) }
>> }
>>
>> I'd like to do that for whole static library, but don't know if it is
>> possible. Decompressing the library is not a clean way. May be there
>> is a command to force compiler (c, cpp) to use specified sections?
>>
>> regards
>> Jan
>>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]