www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/08/17:04:45

Date: Wed, 09 Jul 1997 09:03:48 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: inline asm ("g" or "a" for input... which is faster?) and memory.h
To: Nate Eldredge <eldredge AT ap DOT net>
Cc: djgpp AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <33C353F4.4248@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <199707081711 DOT KAA26916 AT adit DOT ap DOT net>

Nate Eldredge wrote:
> 
> That bothers me slightly. It seems that certain functions such as strcpy,
> memset, etc, are magically known about by the compiler (it refers to them as
> builtin functions). This means I can't put a strcpy of my own in the program
> unless it goes in the same source file; otherwise GCC will inline its own.
> 
> I realize rewriting strcpy would be very non-ANSI and otherwise bad, but it
> seems almost like the compiler is taking liberties with the code.

Here's some peace of mind :) found this in the gcc docs.

`-fno-builtin'
     Don't recognize builtin functions that do not begin with two
     leading underscores.  Currently, the functions affected include
     `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
     `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
     `strlen'.

     GCC normally generates special code to handle certain builtin
     functions more efficiently; for instance, calls to `alloca' may
     become single instructions that adjust the stack directly, and
     calls to `memcpy' may become inline copy loops.  The resulting
     code is often both smaller and faster, but since the function
     calls no longer appear as such, you cannot set a breakpoint on
     those calls, nor can you change the behavior of the functions by
     linking with a different library.

     The `-ansi' option prevents `alloca' and `ffs' from being builtin
     functions, since these functions do not have an ANSI standard
     meaning.

Bill
-- 
Leave others their otherness.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019