This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: How to set a memory size of a section with ld script
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Yuriy Zhilovets <yz at forth dot org dot ru>
- Cc: binutils at sourceware dot org
- Date: Mon, 30 Apr 2007 18:15:55 +0930
- Subject: Re: How to set a memory size of a section with ld script
- References: <4633A826.8010801@forth.org.ru>
On Sat, Apr 28, 2007 at 11:01:42PM +0300, Yuriy Zhilovets wrote:
> I need to make some code with a large trailing of free space after it.
> So I guess that I need a section which image must be greater in memory
> than in a file, that is a section which will map to a segment with
> p_memsz > p_filesz
ld does this already for bss sections.
> How can I achieve this with ld script or by other means?
I suggest you create your own bss section (@nobits type) and use a
linker script to place it after your code section. Keep the
attributes similar to your code section (in particular don't make your
bss section writable if the code section isn't writable) and the
linker should place it in the same segment.
--
Alan Modra
IBM OzLabs - Linux Technology Centre