Meaty Skeleton: Difference between revisions

Jump to navigation Jump to search
Preparatory work for a change where I will remove the use of -fbuiltin because it's not safe for use within the system implementation itself.
[unchecked revision][unchecked revision]
(Add the link to the Going Further on x86 guide to Meaty Skeleton)
(Preparatory work for a change where I will remove the use of -fbuiltin because it's not safe for use within the system implementation itself.)
Line 152:
The special <tt>__is_myos_kernel</tt> macro lets the source code detect whether
it is part of the kernel.
 
The kernel is built with <tt>-fbuiltin</tt>, which promises that the C standard
functions doesn't do anything unusual. This lets the compiler optimize certain
compile-time constant expressions such as <tt>strlen("foo")</tt> to <tt>3</tt>.
However, this can have unexpected consequences as a function call can be changed
into a call to another function. For instance, GCC likes to rewrite
<tt>printf("Hello, World!\n")</tt> into <tt>puts("Hello, World!")</tt>. This is
not a terrible problem if you add the needed functions to libk as you need them,
or you can simply remove <tt>-fbuiltin</tt> as <tt>-ffreestanding</tt> turns it
off by default.
 
== libc and libk Design ==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu