This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: forcing ld to make a set of sections adjacent?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]