cannot find entry symbol _start while linking
Posted: Wed Nov 05, 2014 7:55 pm
There is a warning while linking: CrossGcc/lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000007c00. I don't know why the linker cannot find _start, I've looked into the boot.o file using readelf, and found the following line:
There is a global func called _start, so the linker should find it, but it didn't. what's wrong with it?
boot.s:
boot.ld:
Relevant code in makefile:
Regards,
mycityofsky
Code: Select all
Symbol table '.symtab' contains 10 entries:
...
8: 00000000 0 FUNC GLOBAL DEFAULT 1 _start
boot.s:
Code: Select all
.section .bootstrap_stack, "w", @nobits
stack_bottom:
.skip 16384 # 16 KiB
stack_top:
.section .text
.global _start
.type _start, @function
_start:
movl $stack_top, %esp
call kernel_main #kernel_main is in the kernel.c file
.loop:
jmp .loop
Code: Select all
ENTRY(_start);
SECTIONS
{
. = 0x7C00;
.text : {*(.text)}
.signature : AT(0x7DFE)
{
SHORT(0xAA55);
}
/DISCARD/ : {*(.eh_frame)}
}
Code: Select all
$(RELEASE)/kernel.o: $(SOURCE)/kernel.c
i686-elf-gcc -c -ffreestanding $< -o $@ -Wall -Wextra
$(RELEASE)/boot.o: $(SOURCE)/boot.s
i686-elf-as $< -o $@
$(RELEASE)/kernel.bin: $(RELEASE)/kernel.o $(RELEASE)/boot.o
i686-elf-gcc -T boot.ld -o $@ -ffreestanding -nostdlib $< -lgcc
mycityofsky