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.
DJGPP auotmatically prepends an underscore to every C symbol. You don't need to do that anymore when you compile a cross compiler, so all those underscores you added before symbol names in your assembly code can be safely removed.
assainator wrote:and i'm not that stupid to not try and include the specific .o file.
That was the first thing I looked at, but no.
Which .o file should itoa() be defined in?
Is the symbol reported as missing actually in the expected .o file?
Why not?
Note that this is what I wrote last time, quoted verbatim.
I add the hint of 'objdump' to answer question #2.
The answer to #3 is most likely a leading underscore problem, effectively solved by deleting any object files you might have lying around from when you still used DJGPP. But I'm just guessing.
Every good solution is obvious once you've found it.
What I see is: The functions that should be in the object file ARE there.
I have itoa in printing.c AND I see itoa is there in the object dump file
But if I look at kernel.c (it calls itoa once) it is there, but in the file it is shown as UNDEFINED (*UND*)
prnt.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 printing.c
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000000 l d .rodata 00000000 .rodata
00000000 l d .comment 00000000 .comment
00000000 g O .bss 00000004 x
00000004 g O .bss 00000004 y
00000000 g O .data 00000004 VidMemPtr
00000004 g O .data 00000002 color
00000008 g O .bss 00000004 margin
00000000 g F .text 0000000d GotoLine
0000000d g F .text 0000000d SetMargin
0000001a g F .text 0000001f SetColor
00000039 g F .text 000000cf PrintChar
00000183 g F .text 0000004d MoveRow
00000108 g F .text 00000040 PrintString
00000000 *UND* 00000000 strlen
00000148 g F .text 0000003b ClearScreen
00000000 *UND* 00000000 memcpy
00000000 *UND* 00000000 memset16
000001d0 g F .text 00000015 GotoXY
000001e5 g F .text 0000000a GetX
000001ef g F .text 0000000a GetY
00000006 g O .data 00000010 numberCharacters
00000020 g O .bss 00000020 tmpItoaArray
000001f9 g F .text 000000bc itoa
000002b5 g F .text 00000088 short2bin
00000011 O *COM* 00000001 bufferBin16
0000033d g F .text 00000079 int2bin
00000021 O *COM* 00000020 bufferBin32
000003b6 g F .text 0000021f printf
Every human has to do something idiot to prevent becoming a complete one
[BITS 32]
global loader
loader:
mov esp, _sys_stack ; This points the stack to the stack area
jmp stublet
; This part MUST be 4byte aligned
ALIGN 4
mboot:
; Multiboot macros to make a few lines later more readable
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_AOUT_KLUDGE equ 1<<16
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
EXTERN code, bss, end
; This is the GRUB Multiboot header. A boot signature
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
;this will call all constructors, call main and destroy everything
stublet:
extern __atstart
extern kmain
extern __atexit
call __atstart
call kmain
call __atexit
jmp $
SECTION .bss
resb 8192 ; This reserves 8KBytes of memory here
_sys_stack:
In what section did you put the asm code? probably in ""
"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 ]
This is why I hate assembly coding....
But there is one problem though. Once I link, LD says that it is already defined in the same file.
I have dumped the symbol table and it says that is is only defined once.