The link instruction are:On Unix-like systems, the traditional behavior of compilers and linkers
is to search for external functions from left to right in the object files
specified on the command line. This means that the object file which
contains the definition of a function should appear after any files which
call that function.
Most current compilers and linkers will search all object files, regardless
of order, but since not all compilers do this it is best to follow the
convention of ordering object files from left to right.
Code: Select all
1. ld -nostdlib -T link.lds -o kernel.elf print_amd64.o main.o kernel.o trapa.o trap.o
2. ld -nostdlib -T link.lds -o kernel.elf kernel.o main.o trapa.o trap.o print_amd64.o
objcopy -O binary kernel.elf kernel.bin
dd if=kernel.bin of=boot.img bs=512 count=100 seek=6 conv=notrunc
qemu-system-x86_64 -cpu Skylake-Server -m 512 -hda boot.img -boot d