Linker script to duplicate input sections

Michael Hennebry hennebry@web.cs.ndsu.nodak.edu
Thu Aug 27 22:16:00 GMT 2009


On Thu, 27 Aug 2009, Dobes wrote:
> I am trying to determine if there is something I can do in my linker script
> to cause the linker to duplicate an input section into multiple output
> sections.  For example, I want the .data section from file.o to be included
> in both outputsections, .data0 and .data1.  Is this possible using the
> linker script and without making changes to the linker itself?

You might need to use objcopy to produce another file to link.

> What I would like to do:
>
> .data0 : {
>  ...
>  file.o(.data)
>  ...
> }
>
> .data1 : {
>  ...
>  file.o(.data)
>  ...
> }
>
> But this only puts file.o's .data section into .data0 since it used it
> first.

-- 
Michael   hennebry@web.cs.ndsu.NoDak.edu
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."



More information about the Binutils mailing list