This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: call instruction question


On Wed, Jan 9, 2013 at 2:14 PM, horseriver <horserivers@gmail.com> wrote:
>
>                 1. why use "fc ff ff ff "  in call instruction?

Answered by John Fine.

>                 2. In my .c source file ,I have not used  strcpy function , so why it is disassembly out here ?
>                 after research , I find this call instruction is corresponding  to this line :
>
>                                sprintf(acpi_device_name(device), "%s", ACPI_EC_DEVICE_NAME);
>                 sprintf is a externel implemented function .
>
>                 but why in disassebly code it is strcpy ?
>
>                 whether something wrong with relocation data?

This is a GCC optimization.  GCC converts
    sprintf(buf, "%s", arg);
into
    strcpy(buf, arg);
because the operations are equivalent and strcpy is more efficient.
By default GCC assumes that it can call any function in the C standard
library.  To turn off this assumption, use the -fno-hosted option that
I already mentioned earlier.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]