The MASM Forum Archive 2004 to 2012

Specialised Projects => Assembler/Compiler Technology => Topic started by: nasm64developer on May 30, 2005, 08:52:58 AM

Title: COFF spec for x64?
Post by: nasm64developer on May 30, 2005, 08:52:58 AM
Does anyone know where I can find a COFF spec for x64?
Title: Re: COFF spec for x64?
Post by: Vortex on May 30, 2005, 09:23:38 AM
Flast assembler is able to emit 64-bit COFF object file, you should ask Privalov about the specification.
Title: Re: COFF spec for x64?
Post by: nasm64developer on May 31, 2005, 02:44:23 AM
> Flast assembler is able to emit 64-bit COFF object file

I tried ML64, YASM, and FASM -- they don't seem to be
able to emit the A0...A3h MOVs. To be fair though, I
did not try very hard.  :-o

                           <0> ; The A0...A3h MOVs use disp64.
                           <0> ; The B8...BFh MOVs use imm64.
                           <0>
                           <0> ; ELF64 supports the following relocations:
                           <0> ; - 8 and PC8 = 14 and 15
                           <0> ; - 16 and PC16 = 12 and 13
                           <0> ; - 32, 32S, and PC32 = 10, 11, and 2
                           <0> ; - 64 = 1 -- should be used for these MOVs?
                           <0>
                           <0> ; COFF64 supports the following relocations:
                           <0> ; - ADDR32 and REL32 = 2 and 4
                           <0> ; - ADDR64 = 1 -- should be used for these MOVs?
                           <0>
                           <0> ; neither ML64 nor YASM nor FASM get it right
                           <0>
0000 48A1F0DEBC9A7856-     <0> mov rax,[0x123456789ABCDEF0]
0008 3412                  <0>
000A 48A3F0DEBC9A7856-     <0> mov [0x123456789ABCDEF0],rax
0012 3412                  <0>
                           <0>
0014 48B8F0DEBC9A7856-     <0> mov rax,0x123456789ABCDEF0
001C 3412                  <0>
                           <0>
                           <0> extern e
                           <0>
001E 48A1-                 <0> mov rax,[e]
0020 [0000000000000000]    <0>
0028 48A3-                 <0> mov [e],rax
002A [0000000000000000]    <0>
                           <0>
0032 48B8-                 <0> mov rax,e
0034 [0000000000000000]    <0>
Title: Re: COFF spec for x64?
Post by: MazeGen on May 31, 2005, 09:22:56 AM
Hi developer,
what's wrong with those encodings? They seem correct to me:


48A1F0DEBC9A78563412  mov rax,[0x123456789ABCDEF0]

48: REX.W -> use 64-bit accumulator

A1: MOV RAX,[moffs64]

F0DEBC9A78563412: 64-bit offset
Title: Re: COFF spec for x64?
Post by: nasm64developer on June 01, 2005, 02:26:40 AM
> what's wrong with those encodings?
> 48A1F0DEBC9A78563412  mov rax,[0x123456789ABCDEF0]

Nothing.

I just had a little trouble getting the various
assemblers to emit them. By now I managed to get
FASM to work for both ELF and COFF. Also, I did
get YASM to work for ELF, but not COFF; it won't
emit ADDR64 relocations for the latter -- which
isn't surprising: there's no support for it in
the source of YASM's COFF backend. Last but not
least, the (slightly older?) version of ML64.EXE
that I'm trying, refuses to emit A0...A3h MOVs,
no matter what I throw at it. Oh well.

Anyway. What I am still looking for is something
like an official COFF64 spec for x86-64.