This is the mail archive of the binutils@sources.redhat.com 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]

ld scripts: overlay of input sections ???


Hi, all.
I am writing boot application and got into one 'optimization' question.
This application must run on two slightly different boards:
one uses IBM PPC 750 processor and some set of peripherals,
and one uses IBM PPC 405 processor and another set of peripherals.
High level functions and interfaces are the same for both boards and share
common libraries (compiled for powerpc instruction set which is common
for both processors).

So I have a set of objects to link like this:

function_*.o - board independent high level functions.
driver_*.o - device specific drivers
board1.o - drivers' structures and main function for board1: board1_main()
board2.o - drivers' structures and main function for board2: board2_main()
rom.o - contains start code for both processors.
It detects the board type and jumps to board1_main() or board2_main().

Since board1.o never used on board 2, and board2.o never used on board 1,
I want "board1.o(.bss COMMON)" to be overlaid with "board2.o(.bss COMMON);
and "board1.o(.sbss .scommon)" to be overlaid with "board2.o(.sbss
.scommon).

For BSS I can write something like this:

OVERLAY : {
    .bss.board1 {board1.o(.bss COMMON)}
    .bss.board2 {board2.o(.bss COMMON)}
}
.bss.all: {*(.bss COMMON)}

But for SBSS this does not work, becouse all "small uninitialized variables"
__must__ be placed in output section named ".sbss".
Otherwise link fails with "bla-bla in wrong section".

So I need syntax like:

.sbss : {
    OVERLAY {
        {board1.o(.sbss .scommon)}
        {board2.o(.sbss .scommon)}
    }
    *(.sbss .scommon)
}

How can I do this ???
Some solutions ???
May be additions to script syntax ???

Thanks.

===
Felix Shvaiger
fshvaige@cisco.com



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