Finding Libc

So,  as you know, I've been tooling around with the LLVM IR syntax and the Gold Parser framework. I have the scaffolding for the CIL conversion 90% done, and I am almost ready to parse the "Hello world" code found in the LLVM documentation. There is just one catch. In the Hello world, there is a call to an external standard io library function called puts(). Those fimilar with C/C++ would know that you include the standard header, #include <stdio> or #include <stdio.h> and you magically gain access to this function.

Porting that specific line into CIL would be easy, i'd just replace any puts call with a WriteLine call included in the standard System Library. This is fine to get the sample code running, but it is not a solution going forward. I need to get a list of basic libc commands and rewrite them to work with the System library in the CLI.


DotGnu Project Resurrected?

Years ago (around 2003-2004), the GNU community was really interested in CIL (at the time called MSIL) and its potential to have a common assembly language across disparate systems. One very real problem with *inx development is the fragmentation of libraries. C# was going to solve that problem (I posit that LLVM IR has effectively solved the problem....but thats my opinion). Many open source projects rose to the occasion of "Freeing" .net and MSIL from the hands of Microsoft. From that rush, we have great frameworks like Mono (and i believe Microsoft felt massive pressure, and decided to release most of the .net framework source under the MS-PL, a fairly open license). Lots of these frameworks died or became less interesting, especially as LLVM finished CLANG, etc.

Fast forward to today, and my need to basically port large portions of libc to .net. It seems DotGnu has already done this. Its under the GPL, but for my purposes, I dont care. This is a proof of concept and once i've finished getting things working, there could be a discussion of the merits of using MIT/X11 based licenses, etc. DotGnu has a module called pnetC, that includes a fairly feature complete port of libc to CIL.

Now that I have a CIL port of libc, its a matter of getting a list of all libc functions and adding the namespace to the call of that method. I'll test this functionality with the puts() function in the example code. This is a much better use of time, then just getting WriteLine to work (though i still may do that, just to get a clean parsing structure finished in the next few hours).

Comments

Popular posts from this blog