cygwin64 gcc compile start address and variable address

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: cygwin64 gcc compile start address and variable address

Post by sortie »

Hi again,

Don't create a 64-bit kernel. It's kinda advanced when you are just starting out. I recommend doing a 32-bit multiboot kernel with GRUB - it is straightforward to get working and it's good enough for a start. You can always add 64-bit support later on. GRUB has poor support for starting 64-bit kernels.

I recommend you follow this tutorial:

http://wiki.osdev.org/Bare_Bones

You should complete ignore the http://wiki.osdev.org/GCC_Cross-Compiler_for_x86_64 tutorial. It's obsolete. If you want a 64-bit cross-compiler simply use --target=x86_64-elf. I strongly recommend you follow the Bare Bones tutorial or you will run into trouble you can't fix.

Also note the '-nostdlib -nostartfiles -nodefaultlibs' option only make sense when you link (not when you compile a single translation unit using -c). Additionally, the '-nostdlib' option is the same as passing both '-nostartfiles -nodefaultlibs'. In other words, you just have to pass '-nostdlib'. But follow the Bare Bones tutorial, it uses the recommended compiler options and I have verified you get a working 32-bit Multiboot kernel without trouble.
Locked