DSO: pc relative symbol address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux