undefined reference to my irq function
Posted: Mon Jan 07, 2013 10:58 am
in irq.c..this is how my functions are declared
extern void irq0();
extern void irq1();
....
and their definitions are in my assembly file start.asm
global _irq0
global _irq1
..
_irq0:
cli
push byte 0
push byte 32
jmp irq_common_stub
_irq1:
cli
push byte 0
push byte 33
jmp irq_common_stub
and here is my linker script link.ld
ENTRY(_kmain)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
where _kmain refers to my kernel's entry c main file
im using the mingw compliler and nasm assembler nad following are the commands im using to compiler the kernel
nasm -f win32 -o start.o start.asm
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o irq.o irq.c
ld -oformat -Tlink.ld start.o main.o irq.o
and im getting the following errors
irq.o : irq.c:(.text+0x10c): undefined reference to `irq0'
irq.o : irq.c:(.text+0x130): undefined reference to `irq1'
so what would could be the problem guys ??
p.s in linker script when i change the _kmain to start i get an error corresponding to undefined reference to _main
extern void irq0();
extern void irq1();
....
and their definitions are in my assembly file start.asm
global _irq0
global _irq1
..
_irq0:
cli
push byte 0
push byte 32
jmp irq_common_stub
_irq1:
cli
push byte 0
push byte 33
jmp irq_common_stub
and here is my linker script link.ld
ENTRY(_kmain)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
where _kmain refers to my kernel's entry c main file
im using the mingw compliler and nasm assembler nad following are the commands im using to compiler the kernel
nasm -f win32 -o start.o start.asm
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o irq.o irq.c
ld -oformat -Tlink.ld start.o main.o irq.o
and im getting the following errors
irq.o : irq.c:(.text+0x10c): undefined reference to `irq0'
irq.o : irq.c:(.text+0x130): undefined reference to `irq1'
so what would could be the problem guys ??
p.s in linker script when i change the _kmain to start i get an error corresponding to undefined reference to _main