From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32115 invoked by alias); 12 Nov 2007 10:32:54 -0000 Received: (qmail 32107 invoked by uid 22791); 12 Nov 2007 10:32:53 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 12 Nov 2007 10:32:48 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id lACAWjEI024890; Mon, 12 Nov 2007 05:32:45 -0500 Received: from pobox.fab.redhat.com (pobox.fab.redhat.com [10.33.63.12]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lACAWjSx012710; Mon, 12 Nov 2007 05:32:45 -0500 Received: from [10.32.4.8] (vpn-4-8.str.redhat.com [10.32.4.8]) by pobox.fab.redhat.com (8.13.1/8.13.1) with ESMTP id lACAWhVm009329; Mon, 12 Nov 2007 05:32:44 -0500 Message-ID: <47382BCA.8010502@redhat.com> Date: Mon, 12 Nov 2007 10:32:00 -0000 From: Nick Clifton User-Agent: Thunderbird 1.5.0.12 (X11/20071018) MIME-Version: 1.0 To: PRC CC: binutils Subject: Re: How to expand the `bss`section and fill it zeros when 'objcopy'ing? References: <200711121539456225128@gmail.com> In-Reply-To: <200711121539456225128@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2007-11/txt/msg00112.txt.bz2 Hi PRC, > I want to create a raw binary file from a ELF image. I invoke the command: > > mips-elf-objcopy -O binary -j ".text" -j ".data" -j ".bss" my.exe my.bin Please note that when you are reporting a problem like this, it helps to mention which version of the binutils you are using. Problems which exist in older versions of the binutils are often fixed in newer versions. > But the size of the output `my.bin` is not the sum of sizes of ".text", ".data" and ".bss". > It is the sum of ".text" and ".data", excluding ".bss". > > How can I make objcopy expand the ".bss" section and fill it zeros? By telling it that the .bss section has contents that should be loaded. Like this: mips-elf-objcopy -O binary -j .text -j .data -j .bss \ --set-section-flags .bss=alloc,load,contents \ my.exe my.bin Cheers Nick