C++ Bare Bones: Difference between revisions

m
no edit summary
[unchecked revision][unchecked revision]
mNo edit summary
mNo edit summary
Line 273:
</source>
 
=== Notes ===
Note:* theThe flags -Wall -Wextra are not exactly required, but using them will certainly help you later on. They might seem to be a pest, but remember: The compiler is your friend!
 
Note #2:* You may be able to use gcc instead of the i586-elf-gcc from the cross-compiler, but this does not work out of the box on at least Windows and 64-bit linux.
Note #3:* The reasons for the disabling of exceptions, RTTI and the stack protector is because they usually require runtime support (which you don't have in a basic kernel don't have). For a more thorough explanation, see the [[C++]] article. There is also an article about the [[GCC_Stack_Smashing_Protector|stack smashing protector]] if you want to enable -fstack-protector.
 
Note #4:* The option -nostdlib is equivalent to passing both -nodefaultlibs and -nostartfiles. You just need to pass -nostdlib.
Note #3: The reasons for the disabling of exceptions, RTTI and the stack protector is because they usually require runtime support (which you in a basic kernel don't have). For a more thorough explanation, see the [[C++]] article. There is also an article about the [[GCC_Stack_Smashing_Protector|stack smashing protector]] if you want to enable -fstack-protector.
Note #5:* Previous versions of this tutorial suggested passing the -fno-builtin option, but this is actually harmful as you most certainly want compiler builtins (without the __builtin_ prefix) as it lets the compiler understand your code better.
 
Note #4: The option -nostdlib is equivalent to passing both -nodefaultlibs and -nostartfiles. You just need to pass -nostdlib.
 
Note #5: Previous versions of this tutorial suggested passing the -fno-builtin option, but this is actually harmful as you most certainly want compiler builtins (without the __builtin_ prefix) as it lets the compiler understand your code better.
 
==linker.ld==
Anonymous user