On 13 Aug 2015, at 18:44, Len Maxwell <[email protected]> wrote:
> 
> Now I understand why fprintf was a macro pointing to printk -- it seems to 
> defeat the builtin inlining and saves us implementing fputs, etc. in order to 
> get diagnostic output from the OCaml runtime.  The mini-os print/printk does 
> a sprintf to a buffer and sends that out via the console ring.
> 
> Enabling -fno-builtin across xen-ocaml could hurt performance.  From [1]: 
> "GCC normally generates special code to handle certain built-in functions 
> more efficiently; for instance, calls to alloca may become single 
> instructions which adjust the stack directly, and calls to memcpy may become 
> inline copy loops."
> 
> I'll find another way to clean up the warnings.  Thanks.
> 
> [1]: 
> https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/C-Dialect-Options.html#C-Dialect-Options
>  
> <https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gcc/C-Dialect-Options.html#C-Dialect-Options>

Yeah, turning off builtins across the board is not ideal, but it's absolutely 
fine to turn them off selectively.  The printf builtin in gcc may also be used 
for format string checking as well, so be careful about disabling other 
unrelated safety checks as well.

One thing that it would be wonderful to do is to undo some of the #define hacks 
that have been in MiniOS for historical reasons.  Now that we have better 
structured header files, it would be good to have explicit prototypes instead 
of #defines for functions like printf, and not just redirect them at the cpp 
level to calls to printk.

-a

_______________________________________________
MirageOS-devel mailing list
[email protected]
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

Reply via email to