Safe Identical Code Folding for X86-64.

Sriraman Tallam tmsriram@google.com
Fri Jan 22 18:44:00 GMT 2010


On Fri, Jan 22, 2010 at 1:13 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> 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

Yes !, thats what I meant. Should have been a copy-paste error on my
part. Thanks for pointing it out.

>
> --
> Eric Botcazou
>



More information about the Binutils mailing list