[llvm-dev] A "Cross-Platform Runtime Library API" in LLVM IR

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Mon May 23 05:43:24 PDT 2016


On 23 May 2016, at 13:35, Lorenzo Laneve <lore97drk at icloud.com> wrote:
> 
> The main disadvantages of the libc integration are:
> - The executables might result a little larger, containing some useless C entities.

Dynamically linking libc adds very little to the binary size.

> - The entry point might be uselessly "heavier than needed", calling useless initializations
> - If a language wants to add its own global initializers, it has to use the main() function called by _start(), and I think that all programs for convention should start from main() 

This has very little to do with libc, but rather to do with the C runtime parts (csu / crt*).  These are misnamed, as they’re not really specific to C.  If you want things like LLVM’s llvm.init globals to work, then you must either use these or use something equivalent.  If you want to start things before main() then you can use exactly the same mechanism as libc.

David



More information about the llvm-dev mailing list