mirror of https://github.com/yasm/yasm.git
- Add elf32 as an alias for -f elf. - Add elf64 as an alias for -f elf -m amd64. Note the old command lines still work. Add a testcase for win64 (includes masm -> yasm mapping, look at win64-dataref.masm and win64-dataref.asm files respectively). svn path=/trunk/yasm/; revision=12520.5.0rc2
parent
253056c994
commit
f1d4bb2670
17 changed files with 2076 additions and 33 deletions
@ -0,0 +1,9 @@ |
||||
# $Id$ |
||||
|
||||
# Assume objfmt_coff is included |
||||
|
||||
YASM_MODULES += objfmt_win64 |
||||
|
||||
EXTRA_DIST += modules/objfmts/win64/tests/Makefile.inc |
||||
|
||||
include modules/objfmts/win64/tests/Makefile.inc |
@ -0,0 +1,5 @@ |
||||
# $Id$ |
||||
|
||||
TESTS += modules/objfmts/win64/tests/win64_test.sh |
||||
|
||||
EXTRA_DIST += modules/objfmts/win32/tests/win64_test.sh |
@ -0,0 +1,109 @@ |
||||
BITS 64 |
||||
|
||||
global x86ident |
||||
global __savident |
||||
extern foobar ; :proc |
||||
extern foobar2 ; :abs |
||||
extern foobar3 ; :qword |
||||
extern foobar4 ; :byte |
||||
|
||||
[SECTION .data] |
||||
__savident dd 0 |
||||
savidentptr dd __savident |
||||
savidentptr2 dq __savident |
||||
x86identptr dd x86ident |
||||
x86identptr2 dq x86ident |
||||
foobarptr dd foobar |
||||
foobarptr2 dq foobar |
||||
foobar2ptr dd foobar2 |
||||
foobar2ptr2 dq foobar2 |
||||
foobar3ptr dd foobar3 |
||||
foobar3ptr2 dq foobar3 |
||||
xptr dd x |
||||
xptr2 dq x |
||||
|
||||
[SECTION .bss] |
||||
x resq 1 |
||||
|
||||
[SECTION .text] |
||||
x86ident: |
||||
; with :proc |
||||
mov ebx, foobar ; WTF ML64.. this had [] |
||||
mov rcx, foobar |
||||
lea rdx, [foobar wrt rip] |
||||
mov rax, [foobar+rcx] |
||||
mov rax, foobar |
||||
mov rbx, foobar |
||||
movzx rax, byte [foobar wrt rip] |
||||
movzx rax, byte [foobar+rax] |
||||
|
||||
; with :abs |
||||
;mov ebx,[foobar2] |
||||
;mov rcx,offset foobar2 |
||||
;lea rdx, foobar2 |
||||
;mov rax, qword ptr foobar2[rcx] |
||||
;mov rax, foobar2 |
||||
;mov rbx, foobar2 |
||||
;movzx rax, byte ptr foobar2 |
||||
;movzx rax, byte ptr foobar2[rax] |
||||
|
||||
; with :qword |
||||
mov ebx, [foobar3 wrt rip] |
||||
mov rcx, foobar3 |
||||
lea rdx, [foobar3 wrt rip] |
||||
mov rax, [foobar3+rcx] |
||||
mov rax, [foobar3 wrt rip] |
||||
mov rbx, [foobar3 wrt rip] |
||||
movzx rax, byte [foobar3 wrt rip] |
||||
movzx rax, byte [foobar3+rax] |
||||
|
||||
; local var (dword) |
||||
mov ebx,[__savident wrt rip] |
||||
mov rcx, __savident |
||||
lea rdx, [__savident wrt rip] |
||||
mov rax, [__savident+rcx] |
||||
mov rax, [__savident wrt rip] |
||||
mov rbx, [__savident wrt rip] |
||||
movzx rax, byte [__savident wrt rip] |
||||
movzx rax, byte [__savident+rax] |
||||
|
||||
; local var (qword) |
||||
mov ebx, [savidentptr2 wrt rip] |
||||
mov rcx, savidentptr2 |
||||
lea rdx, [savidentptr2 wrt rip] |
||||
mov rax, [savidentptr2+rcx] |
||||
mov rax, [savidentptr2 wrt rip] |
||||
mov rbx, [savidentptr2 wrt rip] |
||||
movzx rax, byte [savidentptr2 wrt rip] |
||||
movzx rax, byte [savidentptr2+rax] |
||||
|
||||
call foobar |
||||
|
||||
ret |
||||
|
||||
trap: sub rsp, 256 |
||||
int3 |
||||
add rsp, 256 |
||||
.end |
||||
|
||||
[SECTION .pdata] |
||||
dd trap |
||||
dd trap.end |
||||
dd $xdatasym |
||||
|
||||
[SECTION .xdata] |
||||
$xdatasym: |
||||
db 1, 7, 2, 0, 7, 1, 0x20, 0 |
||||
|
||||
[SECTION _FOO] |
||||
foo_foobar3ptr dd foobar3 |
||||
foo_foobar3ptr2 dq foobar3 |
||||
mov ebx, [foobar3 wrt rip] |
||||
mov rcx, foobar3 |
||||
lea rdx, [foobar3 wrt rip] |
||||
mov rax, [foobar3+rcx] |
||||
mov rax, [foobar3 wrt rip] |
||||
mov rbx, [foobar3 wrt rip] |
||||
movzx rax, byte [foobar3 wrt rip] |
||||
movzx rax, byte [foobar3+rax] |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,110 @@ |
||||
public x86ident |
||||
public __savident |
||||
extrn foobar : proc |
||||
extrn foobar2 : abs |
||||
extrn foobar3 : qword |
||||
extrn foobar4 : byte |
||||
|
||||
_DATA SEGMENT |
||||
__savident dd 0 |
||||
savidentptr dd __savident |
||||
savidentptr2 dq __savident |
||||
x86identptr dd x86ident |
||||
x86identptr2 dq x86ident |
||||
foobarptr dd foobar |
||||
foobarptr2 dq foobar |
||||
foobar2ptr dd foobar2 |
||||
foobar2ptr2 dq foobar2 |
||||
foobar3ptr dd foobar3 |
||||
foobar3ptr2 dq foobar3 |
||||
xptr dd x |
||||
xptr2 dq x |
||||
;dataptr dd offset _DATA |
||||
;dataptr2 dq offset _DATA |
||||
;codeptr dd offset _TEXT |
||||
;codeptr2 dq offset _TEXT |
||||
|
||||
_DATA ENDS |
||||
_BSS SEGMENT |
||||
x dq ? |
||||
|
||||
_BSS ENDS |
||||
_TEXT SEGMENT |
||||
x86ident: |
||||
; with :proc |
||||
mov ebx,[foobar] |
||||
mov rcx,offset foobar |
||||
lea rdx, foobar |
||||
mov rax, qword ptr foobar[rcx] |
||||
mov rax, foobar |
||||
mov rbx, foobar |
||||
movzx rax, byte ptr foobar |
||||
movzx rax, byte ptr foobar[rax] |
||||
|
||||
; with :abs |
||||
;mov ebx,[foobar2] |
||||
;mov rcx,offset foobar2 |
||||
;lea rdx, foobar2 |
||||
;mov rax, qword ptr foobar2[rcx] |
||||
;mov rax, foobar2 |
||||
;mov rbx, foobar2 |
||||
;movzx rax, byte ptr foobar2 |
||||
;movzx rax, byte ptr foobar2[rax] |
||||
|
||||
; with :qword |
||||
mov ebx, dword ptr [foobar3] |
||||
mov rcx,offset foobar3 |
||||
lea rdx, foobar3 |
||||
mov rax, qword ptr foobar3[rcx] |
||||
mov rax, foobar3 |
||||
mov rbx, foobar3 |
||||
movzx rax, byte ptr foobar3 |
||||
movzx rax, byte ptr foobar3[rax] |
||||
|
||||
; local var (dword) |
||||
mov ebx,[__savident] |
||||
mov rcx,offset __savident |
||||
lea rdx, __savident |
||||
mov rax, qword ptr __savident[rcx] |
||||
mov rax, qword ptr __savident |
||||
mov rbx, qword ptr __savident |
||||
movzx rax, byte ptr __savident |
||||
movzx rax, byte ptr __savident[rax] |
||||
|
||||
; local var (qword) |
||||
mov ebx, dword ptr [savidentptr2] |
||||
mov rcx,offset savidentptr2 |
||||
lea rdx, savidentptr2 |
||||
mov rax, savidentptr2[rcx] |
||||
mov rax, savidentptr2 |
||||
mov rbx, savidentptr2 |
||||
movzx rax, byte ptr savidentptr2 |
||||
movzx rax, byte ptr savidentptr2[rax] |
||||
|
||||
call foobar |
||||
|
||||
ret |
||||
|
||||
trap proc public frame |
||||
sub rsp, 256 |
||||
.allocstack 256 |
||||
.endprolog |
||||
int 3 |
||||
add rsp, 256 |
||||
trap endp |
||||
|
||||
_TEXT ENDS |
||||
|
||||
_FOO SEGMENT |
||||
foo_foobar3ptr dd foobar3 |
||||
foo_foobar3ptr2 dq foobar3 |
||||
mov ebx, dword ptr [foobar3] |
||||
mov rcx,offset foobar3 |
||||
lea rdx, foobar3 |
||||
mov rax, qword ptr foobar3[rcx] |
||||
mov rax, foobar3 |
||||
mov rbx, foobar3 |
||||
movzx rax, byte ptr foobar3 |
||||
movzx rax, byte ptr foobar3[rax] |
||||
_FOO ENDS |
||||
END |
@ -0,0 +1,4 @@ |
||||
#! /bin/sh |
||||
# $Id$ |
||||
${srcdir}/out_test.sh win64_test modules/objfmts/win64/tests "win64 objfmt" "-f win64" ".obj" |
||||
exit $? |
Loading…
Reference in new issue