This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
How to create an image file with a specific size from a linked absolute code
- From: ali hagigat <hagigatali at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 16 May 2011 11:09:35 +0430
- Subject: How to create an image file with a specific size from a linked absolute code
I am using two assembly files and a linker script like what follows:
asm2.s:
#comment1
.comm dovom, 10
.byte 12,15,28
aval:
movl %edx, 32(%edi)
asm3.s:
.section .text
.comm dovom, 10
aval:
movl $26, %eax
asm2.ld:
SECTIONS
{
section5 0 :
{
*(.data);
*(.bss);
} = 0xffffffff
.text 0x400000 :
{
*(.text);
BYTE(0x57);
BYTE(0x58);
BYTE(0x59);
} = 0xffffffff
}
It means that between between section5 and .text there is a huge gap!
Then I compile with:
ld asm2.o asm3.o -T asm2.ld -o asm2
objcopy -O binary asm2 asm2.img
I want my final image, means asm2.img, becomes 4 mega bytes and the
space between section5 and .text gets filled by 0xff.
I wonder if anybody knows how to do.
Thank you.