This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to allow strlen expander to fail
- To: martin at loewis dot home dot cs dot tu-berlin dot de, toon at moene dot indiv dot nluug dot nl
- Subject: Re: Patch to allow strlen expander to fail
- From: Phil Edwards <pedwards at jaj dot com>
- Date: Tue, 7 Mar 2000 17:20:51 -0500
- Cc: gcc at gcc dot gnu dot org, jbuck at racerx dot synopsys dot com, law at cygnus dot com, vonbrand at sleipnir dot valparaiso dot cl
Toon Moene wrotes:
> Martin v. Loewis wrote:
>
> > I can't see how linking libgcc helps; it does not provide a version of
> > memcpy, either. GCC currently assumes that the programs it generates
> > will be linked with the system's standard C library; that assumption
> > is incorrect for a freestanding environment.
>
> Well, that's great, but the C Standard only asserts that there are two
> execution environments defined - it doesn't say how a particular
> compiler discerns whether it is compiling for one or the other
> environment.
>
> I think this can only be solved by having a compile time switch that
> makes clear which of the two environments one compiles for. It's
> amazing to me that a compiler that's used so much in the embedded
> community, doesn't even _have_ -hosted and -freestanding options.
We're still talking about GCC, right? Your wish has already been granted.
:-) From the pages for 2.95.2:
# `-fhosted'
# Assert that compilation takes place in a hosted environment. This
# 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 environment.
# This implies `-fno-builtin'. A freestanding environment is one
# in which the standard library may not exist, and program startup
# may not necessarily be at `main'. The most obvious example is an
# OS kernel. This is equivalent to `-fno-hosted'.
I couldn't tell you how those switches get used in the source, or what
they currently affect.
Luck++;
Phil