Manipulating text section size manually

0

I have linker script as follows,

MEMORY { ROM: ORIGIN = 0x00000000 LENGTH = 128K }
MEMORY { RAM: ORIGIN = 0xA0000000 LENGTH = 128K }
      .text :
      {
        *(.text.init)
        *(.text.entry)
        *(.text.exception)
        *(.text .text.*)
        *(.rdata)
        *(.rodata .rodata.*)
        _etext = .;
      } > ROM

      .data : AT (ADDR(.text) + SIZEOF(.text))
      {
        _data = .;
        *(vector_table)
        *(.data .data.*)
        *(.sdata* .sdata.*)
        _edata = .;
      } > RAM

Now when I compile and check the object dump my sections are as expected. My data is present in ROM at offset 0x5910 - 0x5a80 but Global symbols are linked to 0xa0000000. Now my startup script can relocate from 0x5910 to 0xA0000000. This should be fine in most cases.

But, we have a final script which reads all elfs and creates one large binary for multiple processors. For some reason the binary reads only executable(Text) section of all elfs(different architecture). Because of this only text section is copied to the final bin. But for this elf I want both text and data to be copied to the final bin.

1) One option is to modify the final script to copy both these section for this particular elf. But this is least preferred since I dont want to touch this script.

2) Or i was thinking is there a way to increase the size of text section in linker script to include .data section also. That way I dont have to modify the final script. Any thoughts?

gcc
linker
gnu
ld
asked on Stack Overflow Mar 11, 2019 by Thomas • edited Mar 12, 2019 by Thomas

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0