This is the mail archive of the binutils@sourceware.org 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: ld --section-start prevents merging sections


On Fri, 13 Nov 2009, Papalagi Pakeha wrote:

I put some functions of my program into a separate text section called
.cryptext and I want to have this section start at a fixed address. To
achieve that I should probably be using
gcc -Wl,--section-start=.cryptext=0x12345678

That works all right as long as .cryptext is only defined in a single
object file. When there are functions in multiple object files placed
in .cryptext then without -Wl,--section-start all the .cryptext
sections are merged into a single one in the final binary, that's what
I want. However with  -Wl,--section-start created .cryptext,
.cryptext.1, .cryptext.2, etc and only the first one is placed at the
specified address.

The problem isn't --section-start . The problem is that .cryptext is an orphan section, i.e. one not mentioned in the linker script. For whatever reason, the linker does that with orphan sections. So far as I know, the only documentation on the subject is in bugzilla somewhere.

--
Michael   hennebry@web.cs.ndsu.NoDak.edu
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."


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