Gentoo Archives: gentoo-amd64

From: Barry.SCHWARTZ@×××××××××××××.org
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] First Impressions
Date: Wed, 27 Sep 2006 17:59:22
Message-Id: 20060927175554.GC27968@crud.crud.mn.org
In Reply to: Re: [gentoo-amd64] First Impressions by Daniel Iliev
1 Daniel Iliev <danny@××××××××.com> skribis:
2 > Well, then I have to simplify more (because of my lack of knowledge) and
3 > ask what are the pros and cons to use PIC when building a program and a
4 > share library?
5
6 When a program runs it needs to know the addresses of variables,
7 subroutines, etc. A shared library can’t know those addresses until
8 run time, when it gets linked into the program. Therefore its code
9 needs to have fancy things done to it so it can be taught where to
10 find things at run time. The PIC stuff is largely overhead. A static
11 library is linked in at program build time, and so doesn’t have this
12 overhead.
13
14 My wild guess is that prelink would need position independent
15 executables because the build-time linker (/usr/bin/ld) doesn’t
16 know how to link a program to a shared library as if it were a static
17 library.
18
19
20 --
21 Barry.SCHWARTZ at chemoelectric.org http://chemoelectric.org
22 Free stuff / Senpagaj varoj: http://crudfactory.com (PDF)
23 'Democracies don't war; democracies are peaceful countries.' - Bush
24 (http://www.whitehouse.gov/news/releases/2005/12/20051219-2.html)