EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9281: LIBCOF library for 32bit Linux links ELF modules


Source & expected listing t9281.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=386,DUMPWIDTH=28 |7439323831 |%test %SET t9281 | |;; | |;; Create the first auxiliary ELF module | |%test.WB PROGRAM FORMAT=ELF,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 "t9281.WB.o",model=FLAT,groups=0,segments=7,entry=,stack= | [],FA=00000000h,RVA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000150h,RVA=00000000h,size=000000C0h=192,width=0,align=0010h,purpose=SYMBOLS | [.rel.text],FA=00000210h,RVA=00000000h,size=00000010h=16,width=0,align=8,purpose=RELOC | [.strtab],FA=00000220h,RVA=00000000h,size=00000060h=96,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=00000280h,RVA=00000000h,size=00000033h=51,width=0,align=1,purpose=STRINGS | [.text],FA=000002C0h,RVA=00000000h,size=00000034h=52,width=32,align=0010h,purpose=CODE | [.rodata],FA=00000300h,RVA=00000000h,size=0000000Dh=13,width=32,align=0010h,purpose=RODATA+LITERAL | **** ListGlobals "t9281.WB.o",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 ELF module. | |%test.EX PROGRAM FORMAT=ELF,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 "t9281.EX.o",model=FLAT,groups=0,segments=7,entry=,stack= | [],FA=00000000h,RVA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000150h,RVA=00000000h,size=00000090h=144,width=0,align=0010h,purpose=SYMBOLS | [.rel.text],FA=000001E0h,RVA=00000000h,size=00000010h=16,width=0,align=8,purpose=RELOC | [.strtab],FA=000001F0h,RVA=00000000h,size=00000044h=68,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=00000234h,RVA=00000000h,size=00000030h=48,width=0,align=1,purpose=STRINGS | [.text],FA=00000270h,RVA=00000000h,size=00000021h=33,width=32,align=0010h,purpose=CODE | [.bss],FA=000002A0h,RVA=00000000h,size=00000007h=7,width=32,align=0010h,purpose=BSS | **** ListGlobals "t9281.EX.o",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 LIBCOF library. | |%test PROGRAM FORMAT=LIBCOF,MODEL=FLAT,WIDTH=32 | | LINK %test.WB.o, %test.EX.o | |ENDPROGRAM %test |# I0560 Linking ELF module ".\t9281.WB.o". |# I0560 Linking ELF module ".\t9281.EX.o". | **** ListMap "t9281.lib",model=FLAT,groups=0,segments=0,entry=,stack= | **** ListGlobals "t9281.lib",Global=0,Public=0,Extern=0,eXport=0,Import=0
Expected messages t9281.out
I0180 Assembling source file "t9281.htm". I0270 Assembling source "t9281". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9281.WB". "t9281.htm"{45} I0510 Assembling program pass 1. "t9281.htm"{45} I0510 Assembling program pass 2. "t9281.htm"{45} I0530 Assembling program pass 3 - final. "t9281.htm"{45} I0660 32bit FLAT ELF file "t9281.WB.o" created, size=781. "t9281.htm"{73} I0650 Program "t9281.WB" assembled in 3 passes with errorlevel 0. "t9281.htm"{73} I0470 Assembling program "t9281.EX". "t9281.htm"{87} I0510 Assembling program pass 1. "t9281.htm"{87} I0510 Assembling program pass 2. "t9281.htm"{87} I0530 Assembling program pass 3 - final. "t9281.htm"{87} I0660 32bit FLAT ELF file "t9281.EX.o" created, size=657. "t9281.htm"{101} I0650 Program "t9281.EX" assembled in 3 passes with errorlevel 0. "t9281.htm"{101} I0470 Assembling program "t9281". "t9281.htm"{115} I0510 Assembling program pass 1. "t9281.htm"{115} I0530 Assembling program pass 2 - final. "t9281.htm"{115} I0560 Linking ELF module ".\t9281.WB.o". "t9281.htm"{117} I0560 Linking ELF module ".\t9281.EX.o". "t9281.htm"{117} I0660 32bit FLAT LIBCOF file "t9281.lib" created, size=1263. "t9281.htm"{117} I0650 Program "t9281" assembled in 2 passes with errorlevel 0. "t9281.htm"{117} I0750 Source "t9281" (236 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9281.htm.lst" created, size=6221. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9281. lib
0000: 21 3C 61 72 63 68 3E 0A 2F 20 20 20 20 20 20 20  !<arch>¬/¯¯¯¯¯¯¯
0010: 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20  ¯¯¯¯¯¯¯¯0¯¯¯¯¯¯¯
0020: 20 20 20 20 30 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯0¯¯¯¯¯0¯¯¯¯¯
0030: 31 30 30 36 36 36 20 20 38 36 20 20 20 20 20 20  100666¯¯86¯¯¯¯¯¯
0040: 20 20 60 0A 00 00 00 07 00 00 01 68 00 00 01 68  ¯¯`¬°°°·°°·h°°·h
0050: 00 00 01 68 00 00 01 68 00 00 03 5E 00 00 03 5E  °°·h°°·h°°·^°°·^
0060: 00 00 03 5E 2E 72 6F 64 61 74 61 00 2E 74 65 78  °°·^.rodata°.tex
0070: 74 00 42 65 65 70 2E 4C 33 32 00 57 72 69 74 65  t°Beep.L32°Write
0080: 2E 4C 33 32 00 2E 62 73 73 00 2E 74 65 78 74 00  .L32°.bss°.text°
0090: 45 78 69 74 2E 4C 33 32 00 0A 2F 20 20 20 20 20  Exit.L32°¬/¯¯¯¯¯
00A0: 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯¯¯¯¯¯¯0¯¯¯¯¯
00B0: 20 20 20 20 20 20 30 20 20 20 20 20 30 20 20 20  ¯¯¯¯¯¯0¯¯¯¯¯0¯¯¯
00C0: 20 20 31 30 30 36 36 36 20 20 38 34 20 20 20 20  ¯¯100666¯¯84¯¯¯¯
00D0: 20 20 20 20 60 0A 02 00 00 00 68 01 00 00 5E 03  ¯¯¯¯`¬·°°°h·°°^·
00E0: 00 00 07 00 00 00 02 00 01 00 02 00 01 00 01 00  °°·°°°·°·°·°·°·°
00F0: 02 00 01 00 2E 62 73 73 00 2E 72 6F 64 61 74 61  ·°·°.bss°.rodata
0100: 00 2E 74 65 78 74 00 2E 74 65 78 74 00 42 65 65  °.text°.text°Bee
0110: 70 2E 4C 33 32 00 45 78 69 74 2E 4C 33 32 00 57  p.L32°Exit.L32°W
0120: 72 69 74 65 2E 4C 33 32 00 0A 2F 2F 20 20 20 20  rite.L32°¬//¯¯¯¯
0130: 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯¯¯¯¯¯¯0¯¯¯¯¯
0140: 20 20 20 20 20 20 30 20 20 20 20 20 30 20 20 20  ¯¯¯¯¯¯0¯¯¯¯¯0¯¯¯
0150: 20 20 31 30 30 36 36 36 20 20 32 20 20 20 20 20  ¯¯100666¯¯2¯¯¯¯¯
0160: 20 20 20 20 60 0A 00 0A 74 39 32 38 31 2E 57 42  ¯¯¯¯`¬°¬t9281.WB
0170: 2F 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20  /¯¯¯¯¯¯¯0¯¯¯¯¯¯¯
0180: 20 20 20 20 30 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯0¯¯¯¯¯0¯¯¯¯¯
0190: 31 30 30 36 36 36 20 20 34 34 32 20 20 20 20 20  100666¯¯442¯¯¯¯¯
01A0: 20 20 60 0A 4C 01 02 00 00 00 00 00 BA 00 00 00  ¯¯`¬L··°°°°°¤°°°
01B0: 0C 00 00 00 00 00 00 01 2E 74 65 78 74 00 00 00  ·°°°°°°·.text°°°
01C0: 00 00 00 00 00 00 00 00 34 00 00 00 64 00 00 00  °°°°°°°°4°°°d°°°
01D0: 98 00 00 00 00 00 00 00 02 00 00 00 20 00 50 60  ¤°°°°°°°·°°°¯°P`
01E0: 2E 72 6F 64 61 74 61 00 00 00 00 00 00 00 00 00  .rodata°°°°°°°°°
01F0: 0D 00 00 00 AC 00 00 00 00 00 00 00 00 00 00 00  ·°°°¤°°°°°°°°°°°
0200: 00 00 00 00 40 00 50 40 31 C9 31 C0 89 F7 F7 D1  °°°°@°P@1¤1¤¤¤¤¤
0210: F2 AE F7 D1 B8 04 00 00 00 BB 01 00 00 00 89 CA  ¤¤¤¤¤·°°°¤·°°°¤¤
0220: 89 F1 CD 80 C3 8D 35 02 00 00 00 E8 D8 FF FF FF  ¤¤¤¤¤¤5·°°°¤¤¤¤¤
0230: 8D 35 00 00 00 00 E8 CD FF FF FF C3 1F 00 00 00  ¤5°°°°¤¤¤¤¤¤·°°°
0240: 02 00 00 00 06 00 2A 00 00 00 02 00 00 00 06 00  ·°°°·°*°°°·°°°·°
0250: 07 00 42 65 65 70 69 6E 67 2E 2E 2E 00 00 2E 66  ·°Beeping...°°.f
0260: 69 6C 65 00 00 00 00 00 00 00 FE FF 00 00 67 01  ile°°°°°°°¤¤°°g·
0270: 74 39 32 38 31 2E 68 74 6D 00 00 00 00 00 00 00  t9281.htm°°°°°°°
0280: 00 00 2E 72 6F 64 61 74 61 00 00 00 00 00 02 00  °°.rodata°°°°°·°
0290: 00 00 03 01 0D 00 00 00 00 00 00 00 00 00 00 00  °°···°°°°°°°°°°°
02A0: 00 00 00 00 00 00 2E 74 65 78 74 00 00 00 00 00  °°°°°°.text°°°°°
02B0: 00 00 01 00 00 00 03 01 34 00 00 00 02 00 00 00  °°·°°°··4°°°·°°°
02C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00  °°°°°°°°°°°°°°·°
02D0: 00 00 02 00 00 00 02 00 01 01 03 00 00 00 00 00  °°·°°°·°···°°°°°
02E0: 13 00 00 00 00 00 00 00 02 00 01 01 03 00 40 4C  ·°°°°°°°·°···°@L
02F0: 54 31 00 00 00 00 02 00 00 00 02 00 01 01 03 00  T1°°°°·°°°·°···°
0300: 40 4C 54 32 00 00 00 00 00 00 00 00 02 00 01 01  @LT2°°°°°°°°·°··
0310: 03 00 42 65 65 70 2E 4C 33 32 1D 00 00 00 01 00  ·°Beep.L32·°°°·°
0320: 01 02 02 00 00 00 00 00 1E 00 00 00 00 00 00 00  ···°°°°°·°°°°°°°
0330: 01 00 01 02 02 00 28 00 00 00 3D 42 22 42 65 65  ·°···°(°°°=B"Bee
0340: 70 69 6E 67 2E 2E 2E 22 00 3D 57 28 30 78 30 30  ping..."°=W(0x00
0350: 30 37 29 00 57 72 69 74 65 2E 4C 33 32 00 74 39  07)°Write.L32°t9
0360: 32 38 31 2E 45 58 2F 20 20 20 20 20 20 20 30 20  281.EX/¯¯¯¯¯¯¯0¯
0370: 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20  ¯¯¯¯¯¯¯¯¯¯0¯¯¯¯¯
0380: 30 20 20 20 20 20 31 30 30 36 36 36 20 20 33 34  0¯¯¯¯¯100666¯¯34
0390: 31 20 20 20 20 20 20 20 60 0A 4C 01 02 00 00 00  1¯¯¯¯¯¯¯`¬L··°°°
03A0: 00 00 9A 00 00 00 09 00 00 00 00 00 00 01 2E 74  °°¤°°°·°°°°°°·.t
03B0: 65 78 74 00 00 00 00 00 00 00 00 00 00 00 21 00  ext°°°°°°°°°°°!°
03C0: 00 00 64 00 00 00 86 00 00 00 00 00 00 00 02 00  °°d°°°¤°°°°°°°·°
03D0: 00 00 20 00 50 60 2E 62 73 73 00 00 00 00 00 00  °°¯°P`.bss°°°°°°
03E0: 00 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00  °°°°°°·°°°°°°°°°
03F0: 00 00 00 00 00 00 00 00 00 00 80 00 50 C0 8D 35  °°°°°°°°°°¤°P¤¤5
0400: 00 00 00 00 C7 06 45 6E 64 00 C7 46 03 0A 00 00  °°°°¤·End°¤F·¬°°
0410: 00 E8 00 00 00 00 31 DB B8 01 00 00 00 CD 80 00  °¤°°°°1¤¤·°°°¤¤°
0420: 02 00 00 00 02 00 00 00 06 00 14 00 00 00 08 00  ·°°°·°°°·°·°°°·°
0430: 00 00 14 00 2E 66 69 6C 65 00 00 00 00 00 00 00  °°·°.file°°°°°°°
0440: FE FF 00 00 67 01 74 39 32 38 31 2E 68 74 6D 00  ¤¤°°g·t9281.htm°
0450: 00 00 00 00 00 00 00 00 2E 62 73 73 00 00 00 00  °°°°°°°°.bss°°°°
0460: 00 00 00 00 02 00 00 00 03 01 00 00 00 00 00 00  °°°°·°°°··°°°°°°
0470: 00 00 00 00 00 00 00 00 00 00 00 00 2E 74 65 78  °°°°°°°°°°°°.tex
0480: 74 00 00 00 00 00 00 00 01 00 00 00 03 01 21 00  t°°°°°°°·°°°··!°
0490: 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00  °°·°°°°°°°°°°°°°
04A0: 00 00 00 00 04 00 00 00 00 00 00 00 02 00 01 01  °°°°·°°°°°°°·°··
04B0: 03 00 45 78 69 74 2E 4C 33 32 00 00 00 00 01 00  ·°Exit.L32°°°°·°
04C0: 01 02 02 00 00 00 00 00 0F 00 00 00 00 00 00 00  ···°°°°°·°°°°°°°
04D0: 00 00 01 01 02 00 19 00 00 00 45 78 69 74 2E 4C  °°···°·°°°Exit.L
04E0: 33 32 2E 4D 00 57 72 69 74 65 2E 4C 33 32 00     32.M°Write.L32°

▲Back to the top▲