input/output sections and linking

Dec 13, 2006 0 Replies

Hi,



I am using my own linker script to build my application. I want to put the .text input section of head.o at the beginning of the .text output section. To achieve this, I have the following in the linker script:



SECTIONS { .text : AT (ADDR(.text) - offset) { *head.o(.text) *(.text) } ... (more sections)



}

Yet still, the .text symbols in head.o appear after some other object.o, which comes at the beginning of .text. The way I do it above is the same as clearly stated in the document "Using ld" Page 40. Any opinions why it doesn't work?



I have therefore declared a section .text.head in head.S, and used: .text : AT (ADDR(.text) - offset) { *(.text.head) *(.text)



}

Now head.o is placed at the beginning. But why not in the first case? Just for reference, my gcc commandline is something like:



% arm-none-eabi-gcc -Tmylink.lds -o start.axf object.o head.o ...



after which object.o ends up at the beginning of .text.



Thanks, Bahadir



Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required