From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8990 invoked by alias); 12 Dec 2007 09:08:42 -0000 Received: (qmail 8976 invoked by uid 22791); 12 Dec 2007 09:08:41 -0000 X-Spam-Check-By: sourceware.org Received: from mtaout02-winn.ispmail.ntl.com (HELO mtaout02-winn.ispmail.ntl.com) (81.103.221.48) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 12 Dec 2007 09:08:27 +0000 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20071212090855.NZFL25022.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Wed, 12 Dec 2007 09:08:55 +0000 Received: from [127.0.0.1] (really [82.25.97.48]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20071212090845.PZJY17393.aamtaout02-winn.ispmail.ntl.com@[127.0.0.1]> for ; Wed, 12 Dec 2007 09:08:45 +0000 Message-ID: <475FA4FF.5010100@ntlworld.com> Date: Wed, 12 Dec 2007 09:08:00 -0000 From: Dave Murphy User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: binutils Subject: Re: How to inform the linker not to produce any data for a .bsssection? References: <20071209200658.GA26653@caradoc.them.org> <200712110919091773244@gmail.com> <20071211125855.GA25143@caradoc.them.org> In-Reply-To: <20071211125855.GA25143@caradoc.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 071211-0, 11/12/2007), Outbound message X-Antivirus-Status: Clean 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-12/txt/msg00070.txt.bz2 Daniel Jacobowitz wrote: > This is necessary alignment. If you don't want .bss to take up space > in the file, do not put allocated sections after it. > Is there any way to change that behavior without causing problems? I'm trying to regain a little extra memory for the heap on a newlib based toolchain where the device binary starts in RAM. It's an arm946 with 48k of tcm. I've tried placing .itcm & .dtcm sections after the .bss section which causes it to consume space in the binary so I tried setting the VMA for the bss to the LMA for the first preceeding section, like this __dtcm_lma = . ; .dtcm __dtcm_start : AT (__dtcm_lma) { *(.dtcm) *(.dtcm.*) . = ALIGN(4); __dtcm_end = ABSOLUTE(.); } >dtcm = 0xff __itcm_lma = __dtcm_lma + SIZEOF(.dtcm); .itcm __itcm_start : AT (__itcm_lma) { *(.itcm) *itcm.*(.text) . = ALIGN(4); __itcm_end = ABSOLUTE(.); } >itcm = 0xff .sbss __dtcm_end : { __sbss_start = ABSOLUTE(.); __sbss_start__ = ABSOLUTE(.); *(.sbss) . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ __sbss_end = ABSOLUTE(.); } >dtcm __bss_lma = __itcm_lma + SIZEOF(.itcm) ; __appended_data = __itcm_lma + SIZEOF(.itcm) ; .bss __bss_lma : AT (__dtcm_lma) { __bss_start = ABSOLUTE(.); __bss_start__ = ABSOLUTE(.); *(.dynbss) *(.gnu.linkonce.b*) *(.bss*) *(COMMON) . = ALIGN(4); /* REQUIRED. LD is flaky without it. */ __bss_end = ABSOLUTE(.) ; __bss_end__ = __bss_end ; } >ewram _end = . ; __end__ = . ; PROVIDE (end = _end); ld errored with "section .bss [0200c5b8 -> 0200c647] overlaps section .itcm [0200c5b8 -> 0200c747]" so I tried placing .bss first & setting the LMA of the following section to the bss segment. That got me the opposite error. __dtcm_lma = . ; __bss_start = .; __bss_start__ = .; .bss : { *(.dynbss) *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. FIXME: Why do we need it? When there is no .bss section, we don't pad the .data section. */ . = ALIGN(. != 0 ? 32 / 8 : 1); } >ewram __bss_end = . ; __bss_end__ = . ; _end = . ; __end__ = . ; .dtcm __dtcm_start : AT (__dtcm_lma) { *(.dtcm) *(.dtcm.*) . = ALIGN(4); __dtcm_end = ABSOLUTE(.); } >dtcm __itcm_lma = __dtcm_lma + SIZEOF(.dtcm); .itcm __itcm_start : AT (__itcm_lma) { *(.itcm) *itcm.*(.text) . = ALIGN(4); __itcm_end = ABSOLUTE(.); } >itcm Dave