This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Omit output section from executable
- From: Daniel Jacobowitz <drow at false dot org>
- To: "Udo A. Steinberg" <us15 at os dot inf dot tu-dresden dot de>
- Cc: binutils at sourceware dot org
- Date: Wed, 2 Aug 2006 16:50:19 -0400
- Subject: Re: Omit output section from executable
- References: <20060802224324.4538786f@laptop.hypervisor.org>
On Wed, Aug 02, 2006 at 10:43:24PM +0200, Udo A. Steinberg wrote:
>
> Hi all,
>
> For an OS kernel I have put all CPU-local data in a specific ELF section named
> ".cpulocal". During bootstrap the kernel allocates a memory page for each CPU
> and maps it to the VMA of the ".cpulocal" section.
>
> I would like the linker to omit the (useless) contents of that section from the
> executable while still maintaining references into the section. I can achieve
> the desired effect by doing an objcopy -R .cpulocal after the final link.
>
> Any way I could do the same with only a linker script and without the objcopy?
I'm not sure exactly what you want, but if the data is useless, try
making the .cpulocal section "nobits".
--
Daniel Jacobowitz
CodeSourcery