OS without linking

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.
Post Reply
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

OS without linking

Post by Hery »

i make my os in real mode (16 bits) i compile it using as and gcc, but i don't link it:

Code: Select all

gcc -c [...] qi.c qex.s
Does it run in real mode (like normal binary file) ?? I don't want to link it if I don't have to do it. [/code]
DruG5t0r3
Member
Member
Posts: 29
Joined: Thu Mar 24, 2005 12:00 am
Contact:

Re: OS without linking

Post by DruG5t0r3 »

I'm fairly sure that you need to tell gcc that your code will be running in 16bit mode at compile time first. How? Don't ask me... man gcc
<h2>-OSdev addict</h2>
rexlunae
Member
Member
Posts: 134
Joined: Sun Oct 24, 2004 11:00 pm
Location: North Dakota, where the buffalo roam

Re: OS without linking

Post by rexlunae »

Hery Sasta wrote:I don't want to link it if I don't have to do it.
Why not?
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: OS without linking

Post by Hery »

DruG5t0r3 wrote:I'm fairly sure that you need to tell gcc that your code will be running in 16bit mode at compile time first. How? Don't ask me... man gcc
ok, but what format of executable file i get if I only use gcc -c and as?? does it format run like binary file
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: OS without linking

Post by Legend »

No, it won't run like a binary file. If you use Linux, you'll get an ELF object(!) file, if use DJGPP, you will get a COFF object file ...
Those NEED to be relocated if you have more then one file, if there are no two files, then there should be no relocation necessary.
*post*
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: OS without linking

Post by Hery »

ok, I need answer like your :D now i must read man gcc :)
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: OS without linking

Post by Legend »

You could try gcc -Xlinker --oformat -Xlinker binary -o qex.s qi.c ...

Then you have a binary, but that invokes the linker ;)

Perhaps objcopy can do what you need in a second step!
*post*
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: OS without linking

Post by Hery »

i'll try lot of options and configurations :D don't worry :D
PS. i have got nasty linker errors and i ask about binary file without ld (i know i'm lazy), but now... :D
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: OS without linking

Post by Hery »

i have problem with my nasty bug :/ when i link os i get lot of errors: "relocation trunaced to fit" this error are connected to variables from heading files, what's wrong?? maybay i must write everywhere:

Code: Select all

extern int...
, it also i connected to $0001 in instruction like this:

Code: Select all

movw $0001, %ax
!!
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: OS without linking

Post by Legend »

You are using the 16 bit ld, don't you? ;)
*post*
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: OS without linking

Post by Hery »

heh, thanks, i don't know which ld i used (now, i'm sure that i used 32 bits ld), heh, i don't khow that 16 bits ld exist ;D
UPDATE: i search in google.com and i can't find 16 bits ld, on gnu.org i also can't find it. Where is 16 bits ld?? (yes, iknow i'm so lazy, but i'm really search it)
Last edited by Hery on Fri Apr 01, 2005 12:00 am, edited 2 times in total.
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: OS without linking

Post by Legend »

After finding some links I'm not that sure if this was a good hint from me :Z

http://lists.debian.org/debian-user/199 ... 00314.html
*post*
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: OS without linking

Post by Hery »

now, i don't know what i should do, thank you very much, i'll check many configurations & options
UPDATE:
when i try ld86 qi.o i've got message qi.o: has got bad magic number, i know that i must use as86, but:
as86 qi.s make lot of errors, in Intel syntax and in AT&T syntax are errors, what's the problem? does ld86 help me??
UPDATE2:
ok, i read som texts, now i've got problem. I'm using bcc and i've got error in instruction like this:

Code: Select all

#if ! defined INCLUDE
..............
#endif
i've got error after word include (sign of new line) does "bcc syntax" need something like { or maybay it's strange error which is only on my computer and i should put computer behind window?? ;)
Last edited by Hery on Sat Apr 02, 2005 12:00 am, edited 2 times in total.
Hery
Member
Member
Posts: 65
Joined: Sat Dec 04, 2004 12:00 am

Re: OS without linking

Post by Hery »

i searched informations about bcc but i don't found it :/
Last edited by Hery on Sat Apr 02, 2005 12:00 am, edited 1 time in total.
Post Reply