From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23198 invoked by alias); 16 May 2011 06:39:54 -0000 Received: (qmail 23187 invoked by uid 22791); 16 May 2011 06:39:53 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_20,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_BJ,TW_JC,TW_XF,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pv0-f169.google.com (HELO mail-pv0-f169.google.com) (74.125.83.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 May 2011 06:39:35 +0000 Received: by pvc12 with SMTP id 12so2943632pvc.0 for ; Sun, 15 May 2011 23:39:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.62.10 with SMTP id p10mr2755276wfk.191.1305527975359; Sun, 15 May 2011 23:39:35 -0700 (PDT) Received: by 10.142.237.9 with HTTP; Sun, 15 May 2011 23:39:35 -0700 (PDT) Date: Mon, 16 May 2011 06:39:00 -0000 Message-ID: Subject: How to create an image file with a specific size from a linked absolute code From: ali hagigat To: binutils@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00206.txt.bz2 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.