how can i compile and link my os parts in windows environment and with GCC & NASM ?
pleas help me and say with wich commandline options i can compile my kernel truly in windows?
the commandlins that i use are :
for NASM:
nasm -f aout loader.asm -o loader.o
for gcc :
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-funct
ions -nostdinc -fno-builtin -I./include -c -o kernel.o kernel.c
for linking :
ld -r -i -e _start -Ttext 0x1000 -o os.o kernel.o graphic.o
for create binary file :
C:\cygwin\bin>objcopy -R .note -R .comment -S -O binary os.o os.bin
for example my problem is in linking , when i want to call an external function that i write in other file for example an OBJ file that compiled with nasm or an OBJ file that compiled with GCC same as graphic.o , after linking these parts , I disassemble the output obj file and i see that when a function called , the call function in assembly code , called an incorrect address that there not exist a valid function .
my NASM version is 2.02
my GCC version is 3.4.4
pleeeeeeas help to me , i work on this problem about 3 month but still i can't solve that .
im sorry for my bad english writing.
Can you solve my problem about linking ?
Re: Can you solve my problem about linking ?
I take it you are using mingw? mingw is bad for OS deving.
Check out this: http://wiki.osdev.org/GCC_Cross-Compiler
Check out this: http://wiki.osdev.org/GCC_Cross-Compiler
Re: Can you solve my problem about linking ?
You use the -r flag for ld. That means that the linked object will be a relocatable executable, thus no function calls will be pointing to the correct locations yet
http://j-software.dk | JPasKernel - My Object Pascal kernel
Re: Can you solve my problem about linking ?
thanks .
I use Cygwin .
now i tray it without -r but still have that problem
I use Cygwin .
now i tray it without -r but still have that problem
Re: Can you solve my problem about linking ?
If you want, you could try my linker. It accepts COFF files only, and produces PE or flat binary output. Read more here.behzad24b wrote:thanks .
I use Cygwin .
now i tray it without -r but still have that problem
Re: Can you solve my problem about linking ?
i download your linker . please help me how it work and how i can use that ?
please say an example about commandline options.
please say an example about commandline options.