Search code examples
linuxgccassemblynasm16-bit

16-bit linking under linux


I'm using NASM Assembler under linux when I use the command "nasm -f elf -l hello.lst hello.asm" it works fine but when linking with gcc "gcc -o hello hello.o" it generates an error :

hello.asm:(.text+0x4): relocation truncated to fit: R_386_16 against `.data' collect2: ld returned 1 exit status

I learned that this is some problem with gcc and 16-bit

any solutions ?


Solution

  • Linux doesn't even have a 16-bit subsystem - even if you got gcc to link it, you still couldn't execute it! Why don't you just use .bits 32?