This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Keep certain relocation entries
- From: "Bernhard Poess" <sigmaz3r0 at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 4 Sep 2008 10:58:00 +0200
- Subject: Keep certain relocation entries
Hi,
For a research project I'm searching for a way to tell gcc to add a
relocation entry for relocations like this:
leaq function(%rip), %some_reg
where function is a resolved symbol in the same assembler file and the
value of function is known.
Is there some switch? Do I have to change the source? If so, where?
I'm working on x86_64 (as you might have guessed).
Big Picture:
I'm searching for a way to automatically find function pointers that
Linux modules hand over to the Linux kernel.
E.g.
struct device dev = {
.probe = my_probe,
.transmit = my_transmit,
}
those get relocation entries of type R_X86_64_64. However if somewhere
in the code somebody does
dev.probe = &my_probe
then this translates to
leaq my_probe(%rip), %rax
and a R_X86_64_PC32 relocation if and only if my_probe's value is not
know to the assembler.
so far I've been hunting down R_X86_64_64 and R_X86_64_PC32
relocations of the above kind. But for some calls there is no
relocation entry (see above). If this could be solved at a better
stage than the relocator, let me know.
Thanks,
-Bernhard