EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9705: ELF object module for 32bit Linux links OMF modules


Source & expected listing t9705.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=386,DUMPWIDTH=28 |7439373035 |%test %SET t9705 | |;; | |;; Create the first auxiliary OMF module | |%test.WB PROGRAM FORMAT=OMF,MODEL=FLAT,WIDTH=32 |[.text] ::::Section changed. |00000000: |Write.L32:: PROC ; Display ASCIIZ string pointed to by ESI using 32bit Linux. |00000000:31C9 | XOR ECX,ECX ; Clear ECX to keep the size of input string. |00000002:31C0 | XOR EAX,EAX ; Clear AL, the searched terminating character |00000004:89F7 | MOV EDI,ESI ; String address. |00000006:F7D1 | NOT ECX ; Assume unlimited possible string size. |00000008:F2AE | REPNE SCASB ; Find the zero terminator. |0000000A:F7D1 | NOT ECX ; Get string size to RCX. |0000000C:B804000000 | MOV EAX,4 ; Kernel service sys_write. |00000011:BB01000000 | MOV EBX,1 ; %1 I/O handle STDOUT_FILENO. |00000016:89CA | MOV EDX,ECX ; %3 String size. |00000018:89F1 | MOV ECX,ESI ; %2 String address. |0000001A:CD80 | INT 0x80 ; Invoke kernel. |0000001C:C3 | RET ; Return to caller. EAX,EBX,ECX,EDX,ESI,EDI are clobbered. |0000001D: | ENDPROC Write.L32: | |;; |0000001D: |Beep.L32:: PROC ; Display message "Beeping.." and play a sound using 32bit Linux. |0000001D:8D35[00000000] | LEA ESI,[=B"Beeping..."] ; Define a literal string in [.rodata]. |00000023:E8D8FFFFFF | CALL Write.L32:: ; Display the notification "Beeping...". |00000028:8D35[00000000] | LEA ESI,[=W(0x0007)] ; Define ASCIIZ string with BEL character in [.rodata]. |0000002E:E8CDFFFFFF | CALL Write.L32:: ; Play the beep sound. |00000033:C3 | RET ; Return to caller. RAX,RCX,RDX,RSI,RDI,R11 are clobbered. |00000034: | ENDPROC Beep.L32: |[@LT2] ====ListLiterals in section [@LT2]. |00000000:0700 =W(0x0007) |[@LT1] ====ListLiterals in section [@LT1]. |00000000:42656570696E672E~=B"Beeping..." | |ENDPROGRAM %test.WB | **** ListMap "t9705.WB.obj",model=FLAT,groups=0,segments=2,entry=,stack= | [.text],FA=00000078h,RVA=00000000h,size=00000034h=52,width=32,align=0010h,purpose=CODE | [.rodata],FA=000000C5h,RVA=00000000h,size=0000000Dh=13,width=32,align=0010h,purpose=RODATA+LITERAL | **** ListGlobals "t9705.WB.obj",Global=0,Public=2,Extern=0,eXport=0,Import=0 | Beep.L32,[.text]:0000001Dh,scope='P' | Write.L32,[.text]:00000000h,scope='P' | |;; | |;; Create the second auxiliary OMF module. | |%test.EX PROGRAM FORMAT=OMF,MODEL=FLAT,WIDTH=32 |[.text] ::::Section changed. |00000000: |Exit.L32:: PROC ; Display message "End", terminate the program. |00000000:8D35[00000000] | LEA ESI,[.M:] ; String "End" will be defined in segment [.bss] at ESI. |00000006:C706456E6400 | MOVD [ESI+0],"End" ; Dynamically define the message "End". |0000000C:C746030A000000 | MOVD [ESI+3],0x0A ; LF+NUL. |00000013:E8(00000000) | CALL Write.L32:: ; Display the notification "End". |00000018:31DB | XOR EBX,EBX ; %1 Errorlevel=0. |0000001A:B801000000 | MOV EAX,1 ; Kernel service sys_exit. |0000001F:CD80 | INT 0x80 ; Invoke kernel. No return to caller. |[.bss] ::::Section changed. |00000000:.............. |.M:DB 7*BYTE ; Reserve space for ASCIIZ string "End" in [.bss]. |[.text] ::::Section changed. |00000021: | ENDPROC Exit.L32: | |ENDPROGRAM %test.EX | **** ListMap "t9705.EX.obj",model=FLAT,groups=0,segments=2,entry=,stack= | [.text],FA=00000071h,RVA=00000000h,size=00000021h=33,width=32,align=0010h,purpose=CODE | [.bss],FA=00000000h,RVA=00000000h,size=00000007h=7,width=32,align=0010h,purpose=BSS | **** ListGlobals "t9705.EX.obj",Global=0,Public=1,Extern=1,eXport=0,Import=0 | Exit.L32,[.text]:00000000h,scope='P' | Write.L32,[Write.L32]:00000000h,scope='E' | |;; | |;; Create the main ELF module. | |%test PROGRAM FORMAT=ELF,MODEL=FLAT,WIDTH=32 | | LINK %test.WB.obj, %test.EX.obj | |ENDPROGRAM %test |# I0560 Linking OMF module ".\t9705.WB.obj". |# I0560 Linking OMF module ".\t9705.EX.obj". | **** ListMap "t9705.o",model=FLAT,groups=0,segments=8,entry=,stack= | [],FA=00000000h,RVA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000180h,RVA=00000000h,size=000000A0h=160,width=0,align=0010h,purpose=SYMBOLS | [.rel.text],FA=00000220h,RVA=00000000h,size=00000018h=24,width=0,align=8,purpose=RELOC | [.strtab],FA=00000238h,RVA=00000000h,size=0000004Ah=74,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=00000282h,RVA=00000000h,size=00000038h=56,width=0,align=1,purpose=STRINGS | [.text],FA=000002C0h,RVA=00000000h,size=00000061h=97,width=32,align=0010h,purpose=CODE | [.rodata],FA=00000330h,RVA=00000000h,size=0000000Dh=13,width=32,align=0010h,purpose=RODATA | [.bss],FA=00000340h,RVA=00000000h,size=00000007h=7,width=32,align=0010h,purpose=BSS | **** ListGlobals "t9705.o",Global=0,Public=3,Extern=0,eXport=0,Import=0 | Beep.L32,[.text]:0000001Dh,scope='P' | Exit.L32,[.text]:00000040h,scope='P' | Write.L32,[.text]:00000000h,scope='P'
Expected messages t9705.out
I0180 Assembling source file "t9705.htm". I0270 Assembling source "t9705". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9705.WB". "t9705.htm"{45} I0510 Assembling program pass 1. "t9705.htm"{45} I0510 Assembling program pass 2. "t9705.htm"{45} I0530 Assembling program pass 3 - final. "t9705.htm"{45} I0660 32bit FLAT OMF file "t9705.WB.obj" created, size=224. "t9705.htm"{73} I0650 Program "t9705.WB" assembled in 3 passes with errorlevel 0. "t9705.htm"{73} I0470 Assembling program "t9705.EX". "t9705.htm"{82} I0510 Assembling program pass 1. "t9705.htm"{82} I0510 Assembling program pass 2. "t9705.htm"{82} I0530 Assembling program pass 3 - final. "t9705.htm"{82} I0660 32bit FLAT OMF file "t9705.EX.obj" created, size=172. "t9705.htm"{96} I0650 Program "t9705.EX" assembled in 3 passes with errorlevel 0. "t9705.htm"{96} I0470 Assembling program "t9705". "t9705.htm"{105} I0510 Assembling program pass 1. "t9705.htm"{105} I0530 Assembling program pass 2 - final. "t9705.htm"{105} I0560 Linking OMF module ".\t9705.WB.obj". "t9705.htm"{107} I0560 Linking OMF module ".\t9705.EX.obj". "t9705.htm"{107} I0660 32bit FLAT ELF file "t9705.o" created, size=829. "t9705.htm"{107} I0650 Program "t9705" assembled in 2 passes with errorlevel 0. "t9705.htm"{107} I0750 Source "t9705" (210 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9705.htm.lst" created, size=6179. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9705. o
0000: 7F 45 4C 46 01 01 01 00 00 00 00 00 00 00 00 00  ¤ELF···°°°°°°°°°
0010: 01 00 03 00 01 00 00 00 00 00 00 00 00 00 00 00  ·°·°·°°°°°°°°°°°
0020: 38 00 00 00 00 00 00 00 34 00 20 00 00 00 28 00  8°°°°°°°4°¯°°°(°
0030: 08 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°·°°°°°°°°°°°°°
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0060: 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
0070: 80 01 00 00 A0 00 00 00 03 00 00 00 07 00 00 00  ¤·°°¤°°°·°°°·°°°
0080: 10 00 00 00 10 00 00 00 09 00 00 00 09 00 00 00  ·°°°·°°°·°°°·°°°
0090: 02 00 00 00 00 00 00 00 20 02 00 00 18 00 00 00  ·°°°°°°°¯·°°·°°°
00A0: 01 00 00 00 05 00 00 00 08 00 00 00 08 00 00 00  ·°°°·°°°·°°°·°°°
00B0: 13 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
00C0: 38 02 00 00 4A 00 00 00 00 00 00 00 00 00 00 00  8·°°J°°°°°°°°°°°
00D0: 01 00 00 00 00 00 00 00 1B 00 00 00 03 00 00 00  ·°°°°°°°·°°°·°°°
00E0: 00 00 00 00 00 00 00 00 82 02 00 00 38 00 00 00  °°°°°°°°¤·°°8°°°
00F0: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
0100: 25 00 00 00 01 00 00 00 06 00 00 00 00 00 00 00  %°°°·°°°·°°°°°°°
0110: C0 02 00 00 61 00 00 00 00 00 00 00 00 00 00 00  ¤·°°a°°°°°°°°°°°
0120: 10 00 00 00 00 00 00 00 2B 00 00 00 01 00 00 00  ·°°°°°°°+°°°·°°°
0130: 02 00 00 00 00 00 00 00 30 03 00 00 0D 00 00 00  ·°°°°°°°0·°°·°°°
0140: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00  °°°°°°°°·°°°°°°°
0150: 33 00 00 00 08 00 00 00 03 00 00 00 00 00 00 00  3°°°·°°°·°°°°°°°
0160: 40 03 00 00 07 00 00 00 00 00 00 00 00 00 00 00  @·°°·°°°°°°°°°°°
0170: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0190: 01 00 00 00 00 00 00 00 00 00 00 00 04 00 F1 FF  ·°°°°°°°°°°°·°¤¤
01A0: 0B 00 00 00 00 00 00 00 00 00 00 00 03 00 07 00  ·°°°°°°°°°°°·°·°
01B0: 10 00 00 00 00 00 00 00 00 00 00 00 03 00 06 00  ·°°°°°°°°°°°·°·°
01C0: 18 00 00 00 00 00 00 00 00 00 00 00 03 00 03 00  ·°°°°°°°°°°°·°·°
01D0: 20 00 00 00 00 00 00 00 00 00 00 00 03 00 01 00  ¯°°°°°°°°°°°·°·°
01E0: 28 00 00 00 00 00 00 00 00 00 00 00 03 00 05 00  (°°°°°°°°°°°·°·°
01F0: 2E 00 00 00 1D 00 00 00 00 00 00 00 10 00 05 00  .°°°·°°°°°°°·°·°
0200: 37 00 00 00 40 00 00 00 00 00 00 00 10 00 05 00  7°°°@°°°°°°°·°·°
0210: 40 00 00 00 00 00 00 00 00 00 00 00 10 00 05 00  @°°°°°°°°°°°·°·°
0220: 1F 00 00 00 01 03 00 00 2A 00 00 00 01 03 00 00  ·°°°··°°*°°°··°°
0230: 42 00 00 00 01 02 00 00 00 74 39 37 30 35 2E 68  B°°°··°°°t9705.h
0240: 74 6D 00 2E 62 73 73 00 2E 72 6F 64 61 74 61 00  tm°.bss°.rodata°
0250: 2E 73 74 72 74 61 62 00 2E 73 79 6D 74 61 62 00  .strtab°.symtab°
0260: 2E 74 65 78 74 00 42 65 65 70 2E 4C 33 32 00 45  .text°Beep.L32°E
0270: 78 69 74 2E 4C 33 32 00 57 72 69 74 65 2E 4C 33  xit.L32°Write.L3
0280: 32 00 00 2E 73 79 6D 74 61 62 00 2E 72 65 6C 2E  2°°.symtab°.rel.
0290: 74 65 78 74 00 2E 73 74 72 74 61 62 00 2E 73 68  text°.strtab°.sh
02A0: 73 74 72 74 61 62 00 2E 74 65 78 74 00 2E 72 6F  strtab°.text°.ro
02B0: 64 61 74 61 00 2E 62 73 73 00 00 00 00 00 00 00  data°.bss°°°°°°°
02C0: 31 C9 31 C0 89 F7 F7 D1 F2 AE F7 D1 B8 04 00 00  1¤1¤¤¤¤¤¤¤¤¤¤·°°
02D0: 00 BB 01 00 00 00 89 CA 89 F1 CD 80 C3 8D 35 02  °¤·°°°¤¤¤¤¤¤¤¤5·
02E0: 00 00 00 E8 D8 FF FF FF 8D 35 00 00 00 00 E8 CD  °°°¤¤¤¤¤¤5°°°°¤¤
02F0: FF FF FF C3 90 90 90 90 90 90 90 90 90 90 90 90  ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
0300: 8D 35 00 00 00 00 C7 06 45 6E 64 00 C7 46 03 0A  ¤5°°°°¤·End°¤F·¬
0310: 00 00 00 E8 A8 FF FF FF 31 DB B8 01 00 00 00 CD  °°°¤¤¤¤¤1¤¤·°°°¤
0320: 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤°°°°°°°°°°°°°°°
0330: 07 00 42 65 65 70 69 6E 67 2E 2E 2E 00           ·°Beeping...°

▲Back to the top▲