public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Force gcc to include builtin functions in the executable
@ 2008-08-05 21:38 Roland Kindermann
  2008-08-08  6:13 ` Daniel Lohmann
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Kindermann @ 2008-08-05 21:38 UTC (permalink / raw)
  To: gcc-help

Hello,

I have a program that uses four builtin functions: __alloca, ___main, 
_memset and _strcpy. While __alloca is compiled directly into the 
executable, the other three are used from a library. Is there a way to 
make gcc compile ___main, _memset and strcpy also into the executable 
such that it does not use any libraries anymore?

I already tried -nostdlib but that results in link errors.

For those who care: The reason why I want my executable independent from 
any libraries is that I perform static analysis on it and my analysis 
tool is not yet able to take additional libraries into account.

Cheers,
Roland

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Force gcc to include builtin functions in the executable
  2008-08-05 21:38 Force gcc to include builtin functions in the executable Roland Kindermann
@ 2008-08-08  6:13 ` Daniel Lohmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lohmann @ 2008-08-08  6:13 UTC (permalink / raw)
  To: Roland Kindermann; +Cc: gcc-help


On 05.08.2008, at 23:38, Roland Kindermann wrote:

> Hello,
>
> I have a program that uses four builtin functions: __alloca,  
> ___main, _memset and _strcpy. While __alloca is compiled directly  
> into the executable, the other three are used from a library. Is  
> there a way to make gcc compile ___main, _memset and strcpy also  
> into the executable such that it does not use any libraries anymore?
>
> I already tried -nostdlib but that results in link errors.
>
> For those who care: The reason why I want my executable independent  
> from any libraries is that I perform static analysis on it and my  
> analysis tool is not yet able to take additional libraries into  
> account.

You may try the explicit builtin-versions (the once that are prefixed  
with "__builtin_", such as "__builtin_strcpy", however, I doubt that  
this helps. AFAIR, builtins of library functions are just an *option*  
the compiler *might* use when this would result in more efficient  
code, but there is no way to force gcc to actually use them under all  
circumstances.


To prevent dependencies to some C library, I would just define own  
versions of the respective functions. After all, they should not be  
that difficult to implement :-)

Daniel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-07 16:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-05 21:38 Force gcc to include builtin functions in the executable Roland Kindermann
2008-08-08  6:13 ` Daniel Lohmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).