converting binary file into object

Christian Groessler cpg@aladdin.de
Sun May 19 10:19:00 GMT 2002


Hi,

I'm trying to include a binary file into an object.

I'm using ld, with the following cmdline

sh-elf-ld  --format binary --oformat elf32-shl input.bin -o output.o \
           -r -EL -T script.ld

script.ld contains this:

SECTIONS { .rodata : { _bin_start = .; *(.data); _bin_end = .; } }

Looking at the resulting obj with objdump gives the following:

-------------------
output.o:     file format elf32-shl
output.o
architecture: sh4, flags 0x00000010:
HAS_SYMS
start address 0x00000000

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .rodata       00000ae8  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, DATA
SYMBOL TABLE:
00000000 l    d  .rodata        00000000 
00000000 l    d  *ABS*  00000000 
00000000 l    d  *ABS*  00000000 
00000000 l    d  *ABS*  00000000 
00000ae8 g       .rodata        00000000 _binary_input_bin_end
00000ae8 g       .rodata        00000000 _bin_end
00000ae8 g       *ABS*  00000000 _binary_input_bin_size
00000000 g       .rodata        00000000 _bin_start
00000000 g       .rodata        00000000 _binary_input_bin_start
-------------------

Now my question: How can I set the .rodata section flags to include
READONLY, and how can I set it's alignment to 4  (2**2)?

regards,
chris



More information about the Binutils mailing list