Safe Identical Code Folding for X86-64.
Eric Botcazou
ebotcazou@adacore.com
Fri Jan 22 09:10:00 GMT 2010
> Here is an example :
>
> int foo()
> {
> return 1;
> }
>
> int bar()
> {
> int (*p)() = foo;
> p();
> }
>
> $ g++ -c test.cc
> $ readelf --relocs test.o
>
> Relocation section '.rela.text._Z3barv' at offset 0x660 contains 2 entries:
> Offset Info Type Sym. Value Sym. Name +
> Addend 00000000000c 000a0000000b R_X86_64_32S 0000000000000000
> _Z3foov + 0 000000000011 000a00000002 R_X86_64_PC32 0000000000000000
> _Z3foov + fffffffffffffffc
You probably meant:
int foo()
{
return 1;
}
int bar()
{
int (*p)() = foo;
foo ();
}
$ g++ -c test.cc -ffunction-sections
--
Eric Botcazou
More information about the Binutils
mailing list