Having trouble with header fiels

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.
montrom
Member
Member
Posts: 86
Joined: Thu May 13, 2010 1:45 pm

Re: Having trouble with header fiels

Post by montrom »

My fault. I thought once you switched over to i586-elf-gcc that you started getting compiler errors. I guess I better leave this one to someone who is actually writing an elf kernel. I use coff, sorry. In parting, I suppose I could leave you this: http://sourceware.org/binutils/docs-2.19/as/Type.html -- it might help.
Visit the Montrom user page for more info.
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: Having trouble with header fiels

Post by HitmanYesman »

Oh, I wasn't trying it with the i586-elf-gcc. I tried again, and now I have the junk at the end of the file thing...
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: Having trouble with header fiels

Post by HitmanYesman »

Common.h is included inside screen.h because screen.c needs common.h So it gets it from screen.h.

berkus: Yeah, it has always worked fine up until this point
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Having trouble with header fiels

Post by Combuster »

HitmanYesman wrote:Common.h is included inside screen.h because screen.c needs common.h So it gets it from screen.h
So everything that needs screen.h gets the pointless payload of common.h even if some other file doesn't need it? For the record, I blame you for the world's inefficiency :wink:

Have you checked that the includes are the ones you wrote, and not something from /usr/include? (you are not using a crosscompiler, for one thing). Also, have you checked the PATH variable before using the cross-compiler?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Having trouble with header fiels

Post by Gigasoft »

I suggest uploading kernel.bin, maybe the problem will be obvious from looking at it.
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: Having trouble with header fiels

Post by HitmanYesman »

Combuster: Oh no, I'm not saying that. I meant that every header file for each object file will include common.h. Must have misunderstood what a cross-compiler is. Yeah, the PATH is set correctly to cygwin/bin.

As for the files. Here's floppy.img and kernel.bin: http://www.mediafire.com/?sharekey=87a5 ... d2eb488dac

I'm sure I'm missing something obvious.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Having trouble with header fiels

Post by Combuster »

HitmanYesman wrote:Yeah, the PATH is set correctly to cygwin/bin.
I bet 50 invisible tokens that that PATH does not contain cygwin/bin, and another 50 that it does not contain only that. Please be accurate when you claim something.
Which brings us to the original point, have you read the tutorial PROPERLY before using the cross-compiler? it includes instructions for the PATH variable as well.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: Having trouble with header fiels

Post by HitmanYesman »

It does contain cygwin/bin. It also contains usr/cross/bin and some other directories.
User avatar
JackScott
Member
Member
Posts: 1032
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Mastodon: https://aus.social/@jackscottau
GitHub: https://github.com/JackScottAU
Contact:

Re: Having trouble with header fiels

Post by JackScott »

It might be helpful at this stage if we determine a few things for certain. Could you please post your complete $PATH variable, and whether or not you've built a cross-compiler (and if so, what $TARGET it is for)?
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: Having trouble with header fiels

Post by HitmanYesman »

Yes, I've built a cross-compiler. $TARGET = i586-elf .

$PATH = "/bin:/usr/local/bin:/usr/bin:/bin"

That's what it says...
Thought there was more
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Having trouble with header fiels

Post by Combuster »

You failed your polygraph test.

I suggest that you go back and read what you said. They don't add up. I hope that when you realize that, you see the conclusion.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: Having trouble with header fiels

Post by HitmanYesman »

I see where it doesn't add up, but don't understand how that makes the CPU fault...
User avatar
JackScott
Member
Member
Posts: 1032
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Mastodon: https://aus.social/@jackscottau
GitHub: https://github.com/JackScottAU
Contact:

Re: Having trouble with header fiels

Post by JackScott »

The earth is turtles all the way down, and one of your turtles is broken. Put another way, you can't build a castle on a foundation of quicksand.

It might be completely unrelated, but how do we know for sure?
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: Having trouble with header fiels

Post by Gigasoft »

Looks like an incorrect relocation has been applied to the call _cls instruction. Either the addend was 6 instead of -5, or the linker neglected to subtract the r_offset field. Somehow, the call to _kmain was relocated correctly.
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: Having trouble with header fiels

Post by HitmanYesman »

How do I fix that? Change the linker script?
Post Reply