mirror of https://github.com/yasm/yasm.git
svn path=/trunk/yasm/; revision=8840.2
parent
dd1d356936
commit
6960b31329
8 changed files with 1038 additions and 40 deletions
@ -0,0 +1,14 @@ |
||||
# $IdPath$ |
||||
|
||||
lib_LTLIBRARIES += yasm-win32.la |
||||
|
||||
yasm_win32_la_SOURCES = \ |
||||
modules/objfmts/coff/coff-objfmt.c |
||||
yasm_win32_la_LDFLAGS = -module -avoid-version -no-undefined |
||||
yasm_win32_la_LIBADD = libyasm.la |
||||
YASM_MODULES += -dlopen yasm-win32.la |
||||
|
||||
EXTRA_DIST += \ |
||||
modules/objfmts/win32/tests/Makefile.inc |
||||
|
||||
include modules/objfmts/win32/tests/Makefile.inc |
@ -0,0 +1,11 @@ |
||||
# $IdPath$ |
||||
|
||||
TESTS += \ |
||||
modules/objfmts/win32/tests/win32_test.sh |
||||
|
||||
EXTRA_DIST += \ |
||||
modules/objfmts/win32/tests/win32_test.sh \ |
||||
modules/objfmts/win32/tests/win32test.c \ |
||||
modules/objfmts/win32/tests/win32test.asm \ |
||||
modules/objfmts/win32/tests/win32test.hex \ |
||||
modules/objfmts/win32/tests/win32test.errwarn |
@ -0,0 +1,82 @@ |
||||
; test source file for assembling to COFF |
||||
; build with (under DJGPP, for example): |
||||
; yasm -f coff cofftest.asm |
||||
; gcc -o cofftest cofftest.c cofftest.o |
||||
|
||||
; This file should test the following: |
||||
; [1] Define and export a global text-section symbol |
||||
; [2] Define and export a global data-section symbol |
||||
; [3] Define and export a global BSS-section symbol |
||||
; [4] Define a non-global text-section symbol |
||||
; [5] Define a non-global data-section symbol |
||||
; [6] Define a non-global BSS-section symbol |
||||
; [7] Define a COMMON symbol |
||||
; [8] Define a NASM local label |
||||
; [9] Reference a NASM local label |
||||
; [10] Import an external symbol |
||||
; [11] Make a PC-relative call to an external symbol |
||||
; [12] Reference a text-section symbol in the text section |
||||
; [13] Reference a data-section symbol in the text section |
||||
; [14] Reference a BSS-section symbol in the text section |
||||
; [15] Reference a text-section symbol in the data section |
||||
; [16] Reference a data-section symbol in the data section |
||||
; [17] Reference a BSS-section symbol in the data section |
||||
|
||||
[BITS 32] |
||||
[GLOBAL _lrotate] ; [1] |
||||
[GLOBAL _greet] ; [1] |
||||
[GLOBAL _asmstr] ; [2] |
||||
[GLOBAL _textptr] ; [2] |
||||
[GLOBAL _selfptr] ; [2] |
||||
[GLOBAL _integer] ; [3] |
||||
[EXTERN _printf] ; [10] |
||||
[COMMON _commvar 4] ; [7] |
||||
|
||||
[SECTION .text] |
||||
|
||||
; prototype: long lrotate(long x, int num); |
||||
_lrotate: ; [1] |
||||
push ebp |
||||
mov ebp,esp |
||||
mov eax,[ebp+8] |
||||
mov ecx,[ebp+12] |
||||
.label rol eax,1 ; [4] [8] |
||||
loop .label ; [9] [12] |
||||
mov esp,ebp |
||||
pop ebp |
||||
ret |
||||
|
||||
; prototype: void greet(void); |
||||
_greet mov eax,[_integer] ; [14] |
||||
inc eax |
||||
mov [localint],eax ; [14] |
||||
push dword [_commvar] |
||||
mov eax,[localptr] ; [13] |
||||
push dword [eax] |
||||
push dword [_integer] ; [1] [14] |
||||
push dword _printfstr ; [13] |
||||
call _printf ; [11] |
||||
add esp,16 |
||||
ret |
||||
|
||||
[SECTION .data] |
||||
|
||||
; a string |
||||
_asmstr db 'hello, world', 0 ; [2] |
||||
|
||||
; a string for Printf |
||||
_printfstr db "integer==%d, localint==%d, commvar=%d" |
||||
db 10, 0 |
||||
|
||||
; some pointers |
||||
localptr dd localint ; [5] [17] |
||||
_textptr dd _greet ; [15] |
||||
_selfptr dd _selfptr ; [16] |
||||
|
||||
[SECTION .bss] |
||||
|
||||
; an integer |
||||
_integer resd 1 ; [3] |
||||
|
||||
; a local integer |
||||
localint resd 1 ; [6] |
@ -0,0 +1,34 @@ |
||||
/*
|
||||
* test source file for assembling to COFF |
||||
* build with (under DJGPP, for example): |
||||
* yasm -f coff cofftest.asm |
||||
* gcc -o cofftest cofftest.c cofftest.o |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
|
||||
extern int lrotate(long, int); |
||||
extern void greet(void); |
||||
extern char asmstr[]; |
||||
extern void *selfptr; |
||||
extern void *textptr; |
||||
extern int integer, commvar; |
||||
|
||||
int main(void) { |
||||
|
||||
printf("Testing lrotate: should get 0x00400000, 0x00000001\n"); |
||||
printf("lrotate(0x00040000, 4) = 0x%08lx\n", lrotate(0x40000,4)); |
||||
printf("lrotate(0x00040000, 14) = 0x%08lx\n", lrotate(0x40000,14)); |
||||
|
||||
printf("This string should read `hello, world': `%s'\n", asmstr); |
||||
|
||||
printf("The integers here should be 1234, 1235 and 4321:\n"); |
||||
integer = 1234; |
||||
commvar = 4321; |
||||
greet(); |
||||
|
||||
printf("These pointers should be equal: %p and %p\n", |
||||
&greet, textptr); |
||||
|
||||
printf("So should these: %p and %p\n", selfptr, &selfptr); |
||||
} |
@ -0,0 +1,660 @@ |
||||
4c |
||||
01 |
||||
03 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
70 |
||||
01 |
||||
00 |
||||
00 |
||||
10 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
0c |
||||
01 |
||||
2e |
||||
74 |
||||
65 |
||||
78 |
||||
74 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
40 |
||||
00 |
||||
00 |
||||
00 |
||||
8c |
||||
00 |
||||
00 |
||||
00 |
||||
cc |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
07 |
||||
00 |
||||
00 |
||||
00 |
||||
20 |
||||
00 |
||||
50 |
||||
60 |
||||
2e |
||||
64 |
||||
61 |
||||
74 |
||||
61 |
||||
00 |
||||
00 |
||||
00 |
||||
40 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
40 |
||||
00 |
||||
00 |
||||
00 |
||||
12 |
||||
01 |
||||
00 |
||||
00 |
||||
52 |
||||
01 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
03 |
||||
00 |
||||
00 |
||||
00 |
||||
40 |
||||
00 |
||||
30 |
||||
c0 |
||||
2e |
||||
62 |
||||
73 |
||||
73 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
80 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
08 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
80 |
||||
00 |
||||
30 |
||||
c0 |
||||
55 |
||||
89 |
||||
e5 |
||||
8b |
||||
45 |
||||
08 |
||||
8b |
||||
4d |
||||
0c |
||||
d1 |
||||
c0 |
||||
e2 |
||||
fc |
||||
89 |
||||
ec |
||||
5d |
||||
c3 |
||||
a1 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
40 |
||||
a3 |
||||
04 |
||||
00 |
||||
00 |
||||
00 |
||||
ff |
||||
35 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
a1 |
||||
34 |
||||
00 |
||||
00 |
||||
00 |
||||
ff |
||||
30 |
||||
ff |
||||
35 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
68 |
||||
0d |
||||
00 |
||||
00 |
||||
00 |
||||
e8 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
81 |
||||
c4 |
||||
10 |
||||
00 |
||||
00 |
||||
00 |
||||
c3 |
||||
12 |
||||
00 |
||||
00 |
||||
00 |
||||
0e |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
18 |
||||
00 |
||||
00 |
||||
00 |
||||
0e |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
1e |
||||
00 |
||||
00 |
||||
00 |
||||
0b |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
23 |
||||
00 |
||||
00 |
||||
00 |
||||
0c |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
2b |
||||
00 |
||||
00 |
||||
00 |
||||
0e |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
30 |
||||
00 |
||||
00 |
||||
00 |
||||
0c |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
35 |
||||
00 |
||||
00 |
||||
00 |
||||
0a |
||||
00 |
||||
00 |
||||
00 |
||||
14 |
||||
00 |
||||
68 |
||||
65 |
||||
6c |
||||
6c |
||||
6f |
||||
2c |
||||
20 |
||||
77 |
||||
6f |
||||
72 |
||||
6c |
||||
64 |
||||
00 |
||||
69 |
||||
6e |
||||
74 |
||||
65 |
||||
67 |
||||
65 |
||||
72 |
||||
3d |
||||
3d |
||||
25 |
||||
64 |
||||
2c |
||||
20 |
||||
6c |
||||
6f |
||||
63 |
||||
61 |
||||
6c |
||||
69 |
||||
6e |
||||
74 |
||||
3d |
||||
3d |
||||
25 |
||||
64 |
||||
2c |
||||
20 |
||||
63 |
||||
6f |
||||
6d |
||||
6d |
||||
76 |
||||
61 |
||||
72 |
||||
3d |
||||
25 |
||||
64 |
||||
0a |
||||
00 |
||||
04 |
||||
00 |
||||
00 |
||||
00 |
||||
11 |
||||
00 |
||||
00 |
||||
00 |
||||
3c |
||||
00 |
||||
00 |
||||
00 |
||||
34 |
||||
00 |
||||
00 |
||||
00 |
||||
0e |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
38 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
3c |
||||
00 |
||||
00 |
||||
00 |
||||
0c |
||||
00 |
||||
00 |
||||
00 |
||||
06 |
||||
00 |
||||
2e |
||||
66 |
||||
69 |
||||
6c |
||||
65 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
fe |
||||
ff |
||||
00 |
||||
00 |
||||
67 |
||||
01 |
||||
2d |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
2e |
||||
74 |
||||
65 |
||||
78 |
||||
74 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
01 |
||||
00 |
||||
00 |
||||
00 |
||||
03 |
||||
01 |
||||
40 |
||||
00 |
||||
00 |
||||
00 |
||||
07 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
5f |
||||
6c |
||||
72 |
||||
6f |
||||
74 |
||||
61 |
||||
74 |
||||
65 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
01 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
5f |
||||
67 |
||||
72 |
||||
65 |
||||
65 |
||||
74 |
||||
00 |
||||
00 |
||||
11 |
||||
00 |
||||
00 |
||||
00 |
||||
01 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
5f |
||||
61 |
||||
73 |
||||
6d |
||||
73 |
||||
74 |
||||
72 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
5f |
||||
74 |
||||
65 |
||||
78 |
||||
74 |
||||
70 |
||||
74 |
||||
72 |
||||
38 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
5f |
||||
73 |
||||
65 |
||||
6c |
||||
66 |
||||
70 |
||||
74 |
||||
72 |
||||
3c |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
5f |
||||
69 |
||||
6e |
||||
74 |
||||
65 |
||||
67 |
||||
65 |
||||
72 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
03 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
5f |
||||
70 |
||||
72 |
||||
69 |
||||
6e |
||||
74 |
||||
66 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
5f |
||||
63 |
||||
6f |
||||
6d |
||||
6d |
||||
76 |
||||
61 |
||||
72 |
||||
04 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
2e |
||||
64 |
||||
61 |
||||
74 |
||||
61 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
02 |
||||
00 |
||||
00 |
||||
00 |
||||
03 |
||||
01 |
||||
40 |
||||
00 |
||||
00 |
||||
00 |
||||
03 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
2e |
||||
62 |
||||
73 |
||||
73 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
03 |
||||
00 |
||||
00 |
||||
00 |
||||
03 |
||||
01 |
||||
08 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
00 |
||||
04 |
||||
00 |
||||
00 |
||||
00 |
Loading…
Reference in new issue