chicken and egg problem in linker script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I seem to have run into a chicken-and-egg problem in ld.  Basically
I need to build an executable file for an ARM embedded system with
the following layout:

    .text at a fixed address
    read-only copy of .data (copied to RAM at startup)
    padding to page boundary (1024-byte page size)
    .data (RAM)
    .bss (RAM)

The problem is that the address of the .data section depends on its
size, because of the read-only copy of it which follows .text.  But
determining the size requires linking it, and ld won't do this without
a constant address.

My inelegant work-around is to do a preliminary link with .data at a
dummy address, use objdump to get the section size, calculate the actual
.data address, and link again.  Is something like this the only way to
handle the problem, or am I overlooking some linker script feature that
could handle this in a single pass?


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux