public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* text base address of a library
@ 2003-09-16 23:05 Umut Aymakoglu
  2003-09-16 23:18 ` David Mosberger
  0 siblings, 1 reply; 2+ messages in thread
From: Umut Aymakoglu @ 2003-09-16 23:05 UTC (permalink / raw)
  To: linux-ia64





Hi -
  Is there a way(function) to find the text base address of a loaded
library?

a.c:
 main()
{
  b();
}

b.c:
b()
{}

%gcc -c b.c
%gcc -shared -o b.sl b.o
%gcc -o a a.c ./b.sl

%ldd a
./c.sl => ./c.sl (0x2000000000044000)  <----------  how can i find this
address within a program?


thanks,
Umut


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: text base address of a library
  2003-09-16 23:05 text base address of a library Umut Aymakoglu
@ 2003-09-16 23:18 ` David Mosberger
  0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger @ 2003-09-16 23:18 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Tue, 16 Sep 2003 16:05:53 -0700, Umut Aymakoglu <umuta@us.ibm.com> said:

  Umut> Hi - Is there a way(function) to find the text base address of
  Umut> a loaded library?

  Umut> a.c: main() { b(); }

  Umut> b.c: b() {}

  Umut> %gcc -c b.c %gcc -shared -o b.sl b.o %gcc -o a a.c ./b.sl

  Umut> %ldd a ./c.sl => ./c.sl (0x2000000000044000) <---------- how
  Umut> can i find this address within a program?

dl_iterate_phdr() is probably what you want.  For better or worse, it
is said to be a trivial interface which requires no documentation [1].
libunwind has some sample code which may help you (see
src/ia64/tables-ia64.c).

	--david

[1] http://sources.redhat.com/ml/libc-alpha/2003-02/msg00031.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-16 23:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-16 23:05 text base address of a library Umut Aymakoglu
2003-09-16 23:18 ` David Mosberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox