Text output; pointer problems

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.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

May I ask why you don't just use ELF? You could then use GRUB and save yourself these sort of errors. I got the ELF-binutils for DJGPP and have never looked back. It also keeps you from doing complex objcopy commands that may break what might be working properly.

Just my $0.02
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

After getting the ELF binutils (and setting the linker script output
format to elf-i386, all warnings are gone (and it works!)

Im primarily doing this from scratch for the experience,
and knowledge of how everything works from the ground up.
I also get more experience with programming itself :wink:

It all seems to be working now (Geez, 5 pages...)

Thanks again everyone!! :D
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post by mystran »

Well, you are specifying in your linker script that you want a binary file out of your kernel.

ld -T script.ld -o outfile *.o

would basicly take your script... make it the whole truth for ld, and then link into outfile.

Now, since your script says you want binary, the result will lack any sort of symbol or section information. In fact, "binary" format files don't even have any identification as to what they contain, so objcopy will be unable to work with files like that..

Anyway, if you've moved to ELF, that's going to make your life easier. But keep in mind, you can't load an ELF file by just dumping it into some point in memory... so if you still don't wanna use GRUB to load your kernel, check out ELF file format.

You'd only need to really look at elf-headers to find where program headers are, and then parse program headers to see what to load and where. For loading a kernel, the relocation stuff and dynamic linking and whatnot ain't very useful, so just ignore. :)
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Post Reply