Author Topic: COFF format does not support non-32-bit relo  (Read 8729 times)

nobody

  • Guest
COFF format does not support non-32-bit relo
« on: October 21, 2005, 12:09:28 PM »
There is a small appliction
;exetest2.asm
;build by
;  nasm -f coff exetest2.asm
;  gcc -o exetest2.exe exetest2.o
section .data
msg db 'Hello!',13,10,'$'

section .text
global _main
_main:
       mov dx, msg
 mov ah, 9
       int 21h
       ret
;end of exetest2.asm

When I build it , nasm will show following error message:
"COFF format does not support non-32-bit relocations"
Could you tell me how to solve this problem?

Thanks!

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: COFF format does not support non-32-bit relo
« Reply #1 on: October 21, 2005, 12:30:55 PM »
mov edx,  msg

Despite the fact that you can use dos interrupts, COFF is a 32-bit format...

Best,
Frank

nobody

  • Guest
Re: COFF format does not support non-32-bit relo
« Reply #2 on: October 22, 2005, 01:06:05 AM »
Could you give me more details?
How to use the 16bit address in the 32bit?

Thanks!

nobody

  • Guest
Re: COFF format does not support non-32-bit relo
« Reply #3 on: October 23, 2005, 03:46:53 AM »
COFF/x86 does support 16-bit relocations (via
type 0001h/0002h instead of 0006h/0014h).

However, NASM's COFF output format lacks sup-
port for them.

You could try another format, e.g. OBJ.

Fwiw, recent 32-bit versions of MS LINK won't
let you link object files that contain 16-bit
relocations. (However, they will let you link
16- and 32-bit code, as long as they only use
32-bit relocations.)