public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* DSO: pc relative symbol address
@ 2010-03-19  9:48 kum
  2010-03-19 18:15 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: kum @ 2010-03-19  9:48 UTC (permalink / raw)
  To: gcc-help

Hi,
Consider the scrap of code

  static int my_foo1(int i)
    {...}

  int (*my_foo)(int) = my_foo1;
  ...

The compiler emits code like this (excerpt from .s)
...
	lw	$2,%got(my_foo1)($28)
...

There are no direct invocation of my_foo1. What prevents the compiler
from emitting a PC relative address to store in my_foo? Something like
  lw $2, PC - <offset>

I guess that this offset is compile-time known quantity. Kindly enlighten me.

If this is possible what compile option(s) turns it on? Is it possible
to do this optimization while building (elf) shared objects too?

Thanks for clearing my ignorance,
kumaresh

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

end of thread, other threads:[~2010-03-22  1:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-19  9:48 DSO: pc relative symbol address kum
2010-03-19 18:15 ` Ian Lance Taylor
2010-03-22  4:38   ` kum

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).