Home | History | Annotate | Download | only in tests
      1 	;; program to test RDOFF production and linkage
      2 
      3 	;; items to test include:
      4 	;;	[1] relocation within the same segment in each module
      5 	;;	[2] relocation to different segments in same module
      6 	;;	[3] relocation to same segment in different module
      7 	;;	[4] relocation to different segment in different module
      8 	;;	[5] relative relocation to same module
      9 	;;	[6] relative relocation to different module
     10 	;;	[7] correct generation of BSS addresses
     11 
     12 [SECTION .text]
     13 [BITS 32]
     14 	
     15 _main:
     16 	mov ax,localdata	; [2] (16 bit) => 66 b8 0000
     17 	mov eax,localdata2	; [2] (32 bit) => b8 0000000a
     18 
     19 [EXTERN _fardata]
     20 
     21 	mov eax,[_fardata]	; [4] => a1 00000000 (+20)
     22 	mov cx,next		; [1] => 66 b9 0012
     23 next:
     24 	call localproc		; [5] => e8 00000019
     25 
     26 [EXTERN _farproc]
     27 	mov eax,_farproc	; [3] => b8 00000000 (+40+0)
     28 	call _farproc		; [6] => e8 -$ (-0+40+0) (=1f)
     29 
     30 	mov eax,localbss	; [7] => b8 00000000
     31 
     32 [GLOBAL _term]
     33 _term:	xor ax,ax		; => 66 31 c0
     34 	int 21h			; => cd 21
     35 	jmp _term		; => e9 -0a (=fffffff6)
     36 
     37 localproc:	
     38 	ret			; => c3
     39 
     40 [GLOBAL _test1proc]
     41 _test1proc:
     42 	call localproc		; [5] => e8 -$ (-0+0+?) (=-6=fffffffa)
     43 	ret			; => c3
     44 			
     45 [SECTION .data]
     46 [GLOBAL localdata2]
     47 localdata:	db 'localdata',0
     48 localdata2:	db 'localdata2',0
     49 farref:		dd _fardata	; [3] => 0 (+20)
     50 localref:	dd _main	; [2] => 0 (+0)
     51 
     52 [SECTION .bss]
     53 localbss:	resw 4		; reserve 8 bytes BSS
     54