Using ld to link a file makes it too big for a boot loader, works in nasm though :(
Using ld to link a file makes it too big for a boot loader, works in nasm though :( I'm trying to make a simple bootloader, but running into issues with ld (I think). When I compile my assembly file (below) with nasm -f bin , it works and I get a nice 512 byte file. For that one I include org 0x7c00 at the top and everything works as expected. nasm -f bin However, now I'm trying to do something a bit more complicated and link in a C kernel (unclear if I'm on the right path there, but I'm sure I'll learn that soon). Anyway, when I compile it with nasm -f elf -o loader_elf bootloader.asm and link it with i386-elf-ld loader_elf -o loader_exe -Ttext 0x7C00 , I get a file that is 4196 bytes (with a 1152 byte elf file). nasm -f elf -o loader_elf bootloader.asm i386-elf-ld loader_elf -o loader_exe -Ttext 0x7C00 What do I need to do for either the elf file or ld to get an executable with a proper file size? Thanks for your help! Here's the file in question: bits 16 ; 1...