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: some question about output section


On Wed, Apr 27, 2011 at 11:29:13PM +0800, loody wrote:
> Dear all:
> I have some questions as below:
> 1. Is it possible to put whole .text of a static library to one output section?
> 2. Is it possible to put whole sections of a static library to one
> output section?
> 3. is it possible for some file B to get address of some function in
> A, while linking?
> 4. usually the address of a static lib is not determined until link
> stage. Is it possible we can pre-defined the address of each function
> in a static lib?

Yes, yes, yes and yes.  As to how you can do this, see ld info doc
node "Input Section Basics" for the answer to (1) and (2).  For (3)
and (4) you're going to need to compile with -ffunction-sections then
write scripts to put the functions where you want them.  An
alternative to (4) is to build a jump table at a fixed address then
define the function entry points on the jump table entries.

-- 
Alan Modra
Australia Development Lab, IBM


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