9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Latchesar Ionkov <lucho@gmx.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Silly porting fun
Date: Wed, 12 Jul 2000 17:44:55 -0400	[thread overview]
Message-ID: <20000712174455.A20431@gmx.net> (raw)
In-Reply-To: <20000712141620.A1017@cyber-dyne.com>

On Wed, Jul 12, 2000 at 02:16:20PM -0700, Randolph Fritz said:
> 
> The typical minimal main program from a GNU configure script is:
> 
>   main() { return(0); }
> 
> The compiler, reasonably enough, decides that this routine never does
> anything and is never called, and optimizes it out of existence!  The
> linker then cannot find main(), and fails.  Is there an option switch
> (preferably) or #pragma I can give to alter this behavior?  Failing
> that, would adding "USED(main);" to the program do the trick?

Compiler cannot decide whether a (global) function is used or not -- that's 
linker job.

Anyway, if you add

        #include "u.h"
	#include "libc.h"
		
in your minimal program it will compile and link just fine.
		
Regards,

	Lucho
			


  reply	other threads:[~2000-07-12 21:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-12 21:16 Randolph Fritz
2000-07-12 21:44 ` Latchesar Ionkov [this message]
2000-07-13  9:59   ` Douglas A. Gwyn
2000-07-13  0:38 ` arisawa
2000-07-12 23:30 forsyth
2000-07-12 23:46 ` Christopher Nielsen
2000-07-13  5:19   ` Randolph Fritz
2000-07-13  0:23 Russ Cox
2000-07-13  0:33 ` Christopher Nielsen
2000-07-13  0:31 Russ Cox
2000-07-13  5:21 ` Randolph Fritz
2000-07-13  8:36 forsyth
2000-07-13 16:01 ` Greg Hudson
2000-07-14  9:15   ` peter huang
2000-07-14  9:19 ` Kris Van Hees
2000-07-14 14:56   ` Douglas A. Gwyn
2000-07-17  9:11   ` Christopher Browne
2000-07-13 20:32 Russ Cox
2000-07-13 23:58 rob pike
2000-07-14  9:18 ` Douglas A. Gwyn
2000-07-14  4:18 pip
2000-07-14  9:58 forsyth
2000-07-16 16:04 ` Lucio De Re
2000-07-14 14:04 bobf
2000-07-14 14:53 Russ Cox
2000-07-14 18:42 dhog

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000712174455.A20431@gmx.net \
    --to=lucho@gmx.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).