1 ;Testname=unoptimized; Arguments=-O0 -fobj -oobj.o; Files=stdout stderr obj.o
2 ;Testname=optimized; Arguments=-Ox -fobj -oobj.o; Files=stdout stderr obj.o
4 ; test source file for assembling to Microsoft 16-bit .OBJ
5 ; build with (16-bit Microsoft C):
6 ; nasm -f obj objtest.asm
7 ; cl /AL objtest.obj objlink.c
8 ; other compilers should work too, provided they handle large
9 ; model in the same way as MS C
11 ; This file should test the following:
12 ; [1] Define and export a global symbol
13 ; [2] Define a non-global symbol
14 ; [3] Define a common symbol
15 ; [4] Define a NASM local label
16 ; [5] Reference a NASM local label
17 ; [6] Import an external symbol
18 ; [7] Make a PC-relative relocated reference
19 ; [8] Reference a symbol in the same section as itself
20 ; [9] Reference a symbol in a different segment from itself
21 ; [10] Define a segment group
22 ; [11] Take the offset of a symbol in a grouped segment w.r.t. its segment
23 ; [12] Reserve uninitialised data space in a segment
24 ; [13] Directly take the segment address of a segment
25 ; [14] Directly take the segment address of a group
26 ; [15] Use SEG on a non-external
27 ; [16] Use SEG on an external
32 global _function
; [1]
34 global _selfptr2
; [1]
35 common _commvar
2 ; [3]
38 group mygroup mybss mydata
; [10]
39 group mygroup2 mycode mycode2
; [10]
41 segment mycode private
48 inc word [_bsssym
] ; [9]
59 call far [cs:.printf
] ; [5] [8]
69 .printf
dw _printf
, seg _printf
; [2] [4] [16]
71 segment mycode2 private
80 _bsssym resw
64 ; [12]
82 segment mydata private
84 _selfptr
dw _selfptr
, seg _selfptr
; [8] [15]
85 _selfptr2
dw _selfptr2 wrt mydata
, mydata
; [11] [13]