문제

I am building an embedded application comprised of several code modules and a static library. Some global variables are explicitly placed in dedicated memory sections (i.e, not the default .data section).

The processor memory architecture is 4 banks, creating a contiguous physical memory space. In my application, only the 1st bank is reserved for code and the other 3 banks are reserved for the explicitly allocated globals and a small stack.

The problem is that the code section (.text) now grew beyond the 1st bank boundary and I get the following linker error message:

./bin/ld: section .data_bank1 loaded at [0000000000002000,0000000000003fff] overlaps section .text loaded at [0000000000000630,00000000000020df]
./bin/ld: section .fini loaded at [00000000000020e0,00000000000020f9] overlaps section .data_bank1 loaded at [0000000000002000,0000000000003fff]

Is there a way to see the object allocations (possibly in a temporary object file) before the linker checks for section and object overlap, and aborts the build?

도움이 되었습니까?

해결책

You can pass the --print-map flag to the linker. This will make it emit details of where each section from each object file is mapped into memory.

Example:

 .text          0x0000000000400370       0x2c /<snip>/lib64/crt1.o
                0x0000000000400370                _start
 .text          0x000000000040039c       0x17 /<snip>/lib64/crti.o
 *fill*         0x00000000004003b3        0xd 90909090
 .text          0x00000000004003c0       0x92 /<snip>/4.6.3/crtbegin.o
 *fill*         0x0000000000400452        0x2 90909090
 .text          0x0000000000400454       0x21 /tmp/ccwAfGkH.o
                0x000000000040045f                x
                0x000000000040046a                y
                0x0000000000400454                main
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top