Free-Standing and Non-OS Dependent

Mike Stump mrs@apple.com
Thu Apr 28 03:33:00 GMT 2005


On Apr 27, 2005, at 12:20 AM, Sriharsha Vedurmudi wrote:
> Finally, they have delivered a port that consisted of gcc, gdb,  
> gas, binutils, glibc and newlib. But the functionlity is very  
> limited, meaning we could not do anything like malloc, printf,  
> strcat, sin, cos, etc. They say that all this is NOT supported in  
> their Free-Standing implementation (which they have penned down as  
> Non OS Dependent port). So, were we cheated? I think so because a  
> port of newlib should mean we can use printf (atleast a stub has to  
> be there).

First, this list has little to do with gcc and more to do with newlib  
and glibc, which, is what you are asking questions about.

Second, without seeing the contract, we don't know what was in it.   
Asking us to guess, is, uhm, pointless.

Third, you didn't say if the contract deliverable was source, or  
binaries, or both.

Take for example, newlib/libc/stdlib/malloc.c

is that part of the deliverable?

is there a built malloc.o somewhere?  Is there any .o or .a file that  
has malloc defined in it?

If no to both of these question, why do you say they delivered  
newlib?  malloc is part of newlib, and should have been provided, if  
newlib was.

They should be willing to help you use the tools they provided.  Ask  
them how to use it, ask them where malloc is.  Ask them what  
delivering newlib means.

> Here is what I understand by the free-standing implementation of gcc:

This is irrelevant, mostly, as gdb isn't part of a freestanding gcc,  
but yet, a contract can specific it.  newlib, as a spec, means a lot  
more than what can be found in a freestanding environment.  If the  
contract was for a port of newlib, then, that is what should be  
delivered.  If you want to know what that means, see for example:

http://sourceware.org/newlib/libc.html#SEC21

clearly, this says malloc is there and should work, well, subject to:

http://sourceware.org/newlib/libc.html#SEC196

which clearly says, you might have to provide sbrk.  I say might, as  
libgloss, part of newlib, provides sbrk.c, which, provides sbrk.   
Might not be perfect for your application, but if not, you can modify  
it and recompile it, or just provide your own definition.

> But, I did not understand what is included in glibc and newlib that  
> constitutes the Non-OS Dependent functionality.

Take for example:

http://sourceware.org/newlib/libc.html#SEC123

this is non-os dependent.  It reads:

   strcat requires no supporting OS subroutines.

this is what that means, the docs cover all the dependencies.

> Hope Im clearer this time,

Actually, it isn't.


Anyway, a competent company would deliver newlib/libgloss, and  
provide source and binaries.  Some of the bits might not be relevant  
to you, but, you should be able to define your own bits to replace  
those bits.  Further, you should be able to modify the source to  
newlib/libgloss to suit your needs and recompile it.

Some of the problem is that you appear not know what to expect, find  
a consultant that knows this space inside and out, and they can  
advise you.  They can tell you if what you've already bought is  
enough to do what you need to do, they can tell you what other  
contracts you'd need filed to do the rest of the work, they can  
evaluate if what you got, is what you bought.  Your needs are beyond  
I think what we can do in this forum.

If the porting company wrote the contract, I'd suspect, they  
delivered what they wrote up, but, claiming newlib/glibc and then,  
saying, well, not really, sounds fishy, there is something big we are  
missing.  We can't help you, because you don't provide any  
information.  A serious evaluation would require the entirety of what  
was delivered to you, and all documentation and contracts.

Anyway, building newlib/libgloss isn't a big deal, heck, even porting  
it, if you had to do that isn't a big deal, just download it, build  
it with the compiler they provided, and presto, you'd be fairly  
close.  See src/libgloss/libnosys for how newlib deals with you, when  
you don't have an OS.  That forms a basis from which you can flesh  
out how much functionality you want.  An example of something that  
you'd actually have to write, would be setjmp, that is my canonical  
example of porting work required in newlib.  But, you only need this,  
if you need it.



More information about the Gcc-help mailing list