This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: forcing ld to make a set of sections adjacent?
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Adam Megacz <adam at megacz dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 7 Nov 2002 22:09:38 +1030
- Subject: Re: forcing ld to make a set of sections adjacent?
- References: <86fzuelei7.fsf@nowhere.com>
On Wed, Nov 06, 2002 at 10:49:52AM -0800, Adam Megacz wrote:
> The question I have is this: is there a generalized way for the
> compiler/assembler to force the linker to make a given set of sections
> adjacent in the resulting binary?
Section ordering is generally done by linker scripts. See SECTIONS
command in ld info files.
> Essentially I want to do something just like the .ctors/.dtors stuff
> for C++, but I can't use .ctors/.dtors to do it. Is ctors/dtors a
> general mechanism I can use, or is are these two symbols considered
> "magic symbols" in the linker?
At least for ELF, I don't think there's anything special about
.ctors/.dtors apart from behaviour conferred by the linker script.
So you should be able to mimic their behaviour using other section
names.
--
Alan Modra
IBM OzLabs - Linux Technology Centre