From: Dave Murphy <wintermute2k4@ntlworld.com>
To: binutils <binutils@sourceware.org>
Subject: Re: How to inform the linker not to produce any data for a .bsssection?
Date: Wed, 12 Dec 2007 09:08:00 -0000 [thread overview]
Message-ID: <475FA4FF.5010100@ntlworld.com> (raw)
In-Reply-To: <20071211125855.GA25143@caradoc.them.org>
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
next prev parent reply other threads:[~2007-12-12 9:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-09 2:51 How to inform the linker not to produce any data for a .bss section? PRC
2007-12-09 20:07 ` Daniel Jacobowitz
2007-12-11 1:19 ` Re: How to inform the linker not to produce any data for a .bsssection? PRC
2007-12-11 12:59 ` Daniel Jacobowitz
2007-12-12 9:08 ` Dave Murphy [this message]
2007-12-12 14:19 ` Daniel Jacobowitz
2007-12-18 10:19 ` Re: Re: How to inform the linker not to produce any data for a.bsssection? PRC
2007-12-18 11:34 ` Ivan Pulleyn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=475FA4FF.5010100@ntlworld.com \
--to=wintermute2k4@ntlworld.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).