This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Safe Identical Code Folding for X86-64.
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Sriraman Tallam <tmsriram at google dot com>
- Cc: binutils at sourceware dot org, Ian Lance Taylor <iant at google dot com>
- Date: Fri, 22 Jan 2010 10:13:01 +0100
- Subject: Re: Safe Identical Code Folding for X86-64.
- References: <863b0cbf1001211651u552ea814jbd53359443caae0@mail.gmail.com>
> 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