This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: some question about output section
- From: Alan Modra <amodra at gmail dot com>
- To: loody <miloody at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 28 Apr 2011 10:26:42 +0930
- Subject: Re: some question about output section
- References: <BANLkTi=2MBUbpUSrtx1N=xV=ODjTkDDxbw@mail.gmail.com>
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