This is the mail archive of the
mailing list for the GCC project.
DSO: pc relative symbol address
- From: kum <a dot kumaresh at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 19 Mar 2010 15:07:41 +0530
- Subject: DSO: pc relative symbol address
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)
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,