public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Is there a way to build a program without stdlib linked to it?
@ 2008-05-14  3:19 William Tambe
  2008-05-14  3:46 ` me22
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: William Tambe @ 2008-05-14  3:19 UTC (permalink / raw)
  To: gcc-help

When I build a program ommiting:
#include <stdio.h> or
#include <stdlib.h>

I get message such as:
implicit declaration of built-in function 'printf' or 'malloc'

Is there a way to build my program in a way that an error such as symbol 
not found is generated instead of gcc linking agains stdlib?

Please let me know.

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

* Re: Is there a way to build a program without stdlib linked to it?
  2008-05-14  3:19 Is there a way to build a program without stdlib linked to it? William Tambe
@ 2008-05-14  3:46 ` me22
  2008-05-14  4:10 ` Tim Prince
  2008-05-14 12:58 ` Ian Lance Taylor
  2 siblings, 0 replies; 4+ messages in thread
From: me22 @ 2008-05-14  3:46 UTC (permalink / raw)
  To: William Tambe; +Cc: gcc-help

On Tue, May 13, 2008 at 10:51 PM, William Tambe <tambewilliam@gmail.com> wrote:
>  I get message such as:
>  implicit declaration of built-in function 'printf' or 'malloc'
>
>  Is there a way to build my program in a way that an error such as symbol
> not found is generated instead of gcc linking agains stdlib?
>

I'm fairly sure that omitting is legal, in C89, so long as the
signature works out.

It might not be in C99 though, so you could try -std=c99 -pedantic

If that doesn't work either, you could always use C++ instead :P

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

* Re: Is there a way to build a program without stdlib linked to it?
  2008-05-14  3:19 Is there a way to build a program without stdlib linked to it? William Tambe
  2008-05-14  3:46 ` me22
@ 2008-05-14  4:10 ` Tim Prince
  2008-05-14 12:58 ` Ian Lance Taylor
  2 siblings, 0 replies; 4+ messages in thread
From: Tim Prince @ 2008-05-14  4:10 UTC (permalink / raw)
  To: William Tambe; +Cc: gcc-help

William Tambe wrote:
> When I build a program ommiting:
> #include <stdio.h> or
> #include <stdlib.h>
>
> I get message such as:
> implicit declaration of built-in function 'printf' or 'malloc'
>
> Is there a way to build my program in a way that an error such as 
> symbol not found is generated instead of gcc linking agains stdlib?
>
You want to cause just those functions to go missing at link time?  On 
most platforms, you could strip functions out of the libraries which are 
linked automatically by gcc. It's outside the realm of gcc, unless those 
are builtins present in libgcc.

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

* Re: Is there a way to build a program without stdlib linked to it?
  2008-05-14  3:19 Is there a way to build a program without stdlib linked to it? William Tambe
  2008-05-14  3:46 ` me22
  2008-05-14  4:10 ` Tim Prince
@ 2008-05-14 12:58 ` Ian Lance Taylor
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2008-05-14 12:58 UTC (permalink / raw)
  To: William Tambe; +Cc: gcc-help

William Tambe <tambewilliam@gmail.com> writes:

> When I build a program ommiting:
> #include <stdio.h> or
> #include <stdlib.h>
>
> I get message such as:
> implicit declaration of built-in function 'printf' or 'malloc'
>
> Is there a way to build my program in a way that an error such as
> symbol not found is generated instead of gcc linking agains stdlib?

See the -nostdlib and -nodefaultlibs options.

Ian

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

end of thread, other threads:[~2008-05-14  4:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-14  3:19 Is there a way to build a program without stdlib linked to it? William Tambe
2008-05-14  3:46 ` me22
2008-05-14  4:10 ` Tim Prince
2008-05-14 12:58 ` Ian Lance Taylor

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).