public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: loody <miloody@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: some question about output section
Date: Thu, 28 Apr 2011 00:57:00 -0000	[thread overview]
Message-ID: <20110428005642.GG19947@bubble.grove.modra.org> (raw)
In-Reply-To: <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

  reply	other threads:[~2011-04-28  0:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 15:29 loody
2011-04-28  0:57 ` Alan Modra [this message]
2011-04-28 16:17   ` loody
2011-04-29  0:32     ` Alan Modra
2011-05-01 13:21       ` loody
2011-05-04 15:51         ` loody
2011-05-05  0:35           ` Alan Modra
2011-05-05  3:00             ` loody
2011-05-05  3:57               ` Alan Modra
2011-05-11  6:27                 ` loody
2011-05-11  7:18                   ` Alan Modra
2011-05-11  8:12                     ` loody
2011-05-18  5:32                     ` loody
2011-05-19  4:31                       ` loody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110428005642.GG19947@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=miloody@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).