Patch to allow strlen expander to fail

Jeffrey A Law law@cygnus.com
Fri Mar 10 10:21:00 GMT 2000


  In message < 20000310090713.A20157@celes.dgate.ORG >you write:
  > And then spake Clinton Popetz, as follows:
  > > On Tue, Mar 07, 2000 at 05:20:51PM -0500, Phil Edwards wrote:
  > > > #  `-fhosted'
  > > > #       Assert that compilation takes place in a hosted environment.  T
  > his
  > > > #       implies `-fbuiltin'.  A hosted environment is one in which the
  > > > #       entire standard library is available, and in which `main' has a
  > > > #       return type of `int'.  Examples are nearly everything except a
  > > > #       kernel.  This is equivalent to `-fno-freestanding'.
  > > > #  `-ffreestanding'
  > > > #       Assert that compilation takes place in a freestanding environme
  > nt.
  > > > #       This implies `-fno-builtin'.  A freestanding environment is one
  > > > #       in which the standard library may not exist, and program startu
  > p
  > > > #       may not necessarily be at `main'.  The most obvious example is 
  > an
  > > > #       OS kernel.  This is equivalent to `-fno-hosted'.
  > 
  > Additionally, I had sent in a bug report about -ffreestanding not
  > affecting gcc's normal behavior of trying to call hosted C-runtime
  > stuff from main() (__main(), etc) using egcs 1.1.1 targetting mips. I
  > found this behavior when trying to compile test cases for a MIPS virtual
  > machine simulator I was writing.  I still think this behavior is wrong.
  > I haven't tested to see whether it exists in the latest snaps, though
  > from the above discussion I am assuming things haven't changed much...
  > anyway, if people are going to be hacking on -ffreestanding, it's probably
  > a good loose end to tie up.
The __main is not a hosted vs non-hosted issue -- the behavior of the
compiler is correct.  __main is critical for the proper behavior of ctors/dtors
which are 100% independent of the hosted vs non-hosted environment.

-ffreestanding does not and will not ever control the call to __main.

jeff



More information about the Gcc mailing list