EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9334: ELF program for 64bit Linux statically linking DSO


Source & expected listing t9334.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=x64,DUMPWIDTH=28 |7439333334 |%test %SET t9334 | |;; | |;; Create auxiliary ELFSO library. | |%test.WBE PROGRAM FORMAT=ELFSO,MODEL=FLAT,WIDTH=64 |[.text] ::::Section changed. |00000000: |Write.L64:: PROC ; Display ASCIIZ string pointed to by RSI using 64bit Linux. |00000000:31C9 | XOR ECX,ECX ; Clear RCX to keep the size of input string. |00000002:31C0 | XOR EAX,EAX ; Clear AL, the searched terminating character |00000004:4889F7 | MOV RDI,RSI ; %2 String address in RSI,RDI. |00000007:48F7D1 | NOT RCX ; Assume unlimited possible string size. |0000000A:F2AE | REPNE SCASB ; Find the zero terminator. |0000000C:48F7D1 | NOT RCX ; Get string size to RCX. |0000000F:B801000000 | MOV RAX,1 ; Kernel service sys_write. |00000014:BF01000000 | MOV RDI,1 ; %1 I/O handle STDOUT_FILENO. |00000019:89CA | MOV EDX,ECX ; %3 String size. |0000001B:0F05 | SYSCALL ; Invoke kernel. |0000001D:C3 | RET ; Return to caller. RAX,RCX,RDX,RSI,RDI,R11 are clobbered. |0000001E: | ENDPROC Write.L64: | |;; |0000001E: |Beep.L64:: PROC ; Display message "Beeping.." and play a sound using 64bit Linux. |0000001E:488D35(00000000) | LEA RSI,[=B"Beeping..."] ; Define a literal string in [.rodata]. |00000025:E8D6FFFFFF | CALL Write.L64:: ; Display the notification "Beeping...". |0000002A:488D35(00000000) | LEA RSI,[=W(0x0007)] ; Define ASCIIZ string with BEL character in [.rodata]. |00000031:E8CAFFFFFF | CALL Write.L64:: ; Play the beep sound. |00000036:C3 | RET ; Return to caller. RAX,RCX,RDX,RSI,RDI,R11 are clobbered. |00000037: | ENDPROC Beep.L64: | |;; |00000037: |Exit.L64:: PROC ; Display message "End", terminate the program. |00000037:488D35(00000000) | LEA RSI,[.M:] ; String "End" will be defined in segment [.bss] at RSI. |0000003E:C706456E6400 | MOVD [RSI+0],"End" ; Dynamically define the message "End". |00000044:C746030A000000 | MOVD [RSI+3],0x0A ; LF+NUL. |0000004B:E8B0FFFFFF | CALL Write.L64:: ; Display the notification "End". |00000050:31FF | XOR EDI,EDI ; %1 Errorlevel=0. |00000052:B83C000000 | MOV RAX,60 ; Kernel service sys_exit. |00000057:0F05 | SYSCALL ; 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. |00000059: | ENDPROC Exit.L64: | |;; | | EXPORT Write.L64,Beep.L64,Exit.L64 |[@LT2] ====ListLiterals in section [@LT2]. |00000000:0700 =W(0x0007) |[@LT1] ====ListLiterals in section [@LT1]. |00000000:42656570696E672E~=B"Beeping..." | | ENDPROGRAM %test.WBE | **** ListMap "t9334.WBE.so",model=FLAT,groups=5,segments=12,entry=,stack= | [LOAD.HDR],FA=00000000h,RVA=00000000h,size=00000817h=2071,group [.symtab] [.dynsym] [.hash] [.dynstr] [.strtab] [.shstrtab] | [],FA=00000000h,RVA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000460h,RVA=00000460h,size=000001C8h=456,width=0,align=8,purpose=SYMBOLS | [.dynsym],FA=00000628h,RVA=00000628h,size=00000060h=96,width=0,align=8,purpose=SYMBOLS | [.rela.text],FA=00000688h,RVA=00000688h,size=00000048h=72,width=0,align=8,purpose=RELOC | [.hash],FA=000006D0h,RVA=000006D0h,size=00000024h=36,width=0,align=4,purpose=HASH | [.dynstr],FA=000006F4h,RVA=000006F4h,size=00000033h=51,width=0,align=1,purpose=STRINGS | [.strtab],FA=00000727h,RVA=00000727h,size=00000098h=152,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=000007BFh,RVA=000007BFh,size=00000058h=88,width=0,align=1,purpose=STRINGS | [LOAD.CODE],FA=00001000h,RVA=00001000h,size=00000059h=89,group [.text] | [.text],FA=00001000h,RVA=00001000h,size=00000059h=89,width=64,align=0010h,purpose=CODE | [LOAD.RODATA],FA=00002000h,RVA=00002000h,size=0000000Dh=13,group [.rodata] | [.rodata],FA=00002000h,RVA=00002000h,size=0000000Dh=13,width=64,align=0010h,purpose=RODATA+LITERAL | [LOAD.DATA],FA=00003000h,RVA=00003000h,size=000000A7h=167,group [.dynamic] [.bss] | [.dynamic],FA=00003000h,RVA=00003000h,size=000000A0h=160,width=0,align=0010h,purpose=DYNAMIC | [.bss],FA=000030A0h,RVA=000030A0h,size=00000007h=7,width=64,align=0010h,purpose=BSS | [DYNAMIC],FA=00003000h,RVA=00003000h,size=000000A0h=160,group | **** ListGlobals "t9334.WBE.so",Global=0,Public=0,Extern=0,eXport=3,Import=0 | Beep.L64,[.text]:0000001Eh,scope='X' | Exit.L64,[.text]:00000037h,scope='X' | Write.L64,[.text]:00000000h,scope='X' | |;; | |;; Create the main COFF library. | |%test PROGRAM FORMAT=LIBCOF,MODEL=FLAT,WIDTH=64 | | LINK %test.WBE.so ; Statically link the auxiliary ELFSO library. | |ENDPROGRAM %test |# I0561 Linking ELFSO library ".\t9334.WBE.so". | **** ListMap "t9334.lib",model=FLAT,groups=0,segments=0,entry=,stack= | **** ListGlobals "t9334.lib",Global=0,Public=0,Extern=0,eXport=0,Import=0
Expected messages t9334.out
I0180 Assembling source file "t9334.htm". I0270 Assembling source "t9334". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9334.WBE". "t9334.htm"{45} I0510 Assembling program pass 1. "t9334.htm"{45} I0510 Assembling program pass 2. "t9334.htm"{45} I0530 Assembling program pass 3 - final. "t9334.htm"{45} I0660 64bit FLAT ELFSO file "t9334.WBE.so" created, size=12448. "t9334.htm"{87} I0650 Program "t9334.WBE" assembled in 3 passes with errorlevel 0. "t9334.htm"{87} I0470 Assembling program "t9334". "t9334.htm"{112} I0510 Assembling program pass 1. "t9334.htm"{112} I0530 Assembling program pass 2 - final. "t9334.htm"{112} I0561 Linking ELFSO library ".\t9334.WBE.so". "t9334.htm"{114} I0660 64bit FLAT LIBCOF file "t9334.lib" created, size=1011. "t9334.htm"{114} I0650 Program "t9334" assembled in 2 passes with errorlevel 0. "t9334.htm"{114} I0750 Source "t9334" (210 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9334.htm.lst" created, size=6065. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9334. 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 37 36 20 20 20 20 20 20  100666¯¯76¯¯¯¯¯¯
0040: 20 20 60 0A 00 00 00 06 00 00 01 52 00 00 01 52  ¯¯`¬°°°·°°·R°°·R
0050: 00 00 01 52 00 00 01 52 00 00 01 52 00 00 01 52  °°·R°°·R°°·R°°·R
0060: 2E 62 73 73 00 2E 72 6F 64 61 74 61 00 2E 74 65  .bss°.rodata°.te
0070: 78 74 00 42 65 65 70 2E 4C 36 34 00 45 78 69 74  xt°Beep.L64°Exit
0080: 2E 4C 36 34 00 57 72 69 74 65 2E 4C 36 34 00 0A  .L64°Write.L64°¬
0090: 2F 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  /¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
00A0: 30 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20  0¯¯¯¯¯¯¯¯¯¯¯0¯¯¯
00B0: 20 20 30 20 20 20 20 20 31 30 30 36 36 36 20 20  ¯¯0¯¯¯¯¯100666¯¯
00C0: 37 32 20 20 20 20 20 20 20 20 60 0A 01 00 00 00  72¯¯¯¯¯¯¯¯`¬·°°°
00D0: 52 01 00 00 06 00 00 00 01 00 01 00 01 00 01 00  R·°°·°°°·°·°·°·°
00E0: 01 00 01 00 2E 62 73 73 00 2E 72 6F 64 61 74 61  ·°·°.bss°.rodata
00F0: 00 2E 74 65 78 74 00 42 65 65 70 2E 4C 36 34 00  °.text°Beep.L64°
0100: 45 78 69 74 2E 4C 36 34 00 57 72 69 74 65 2E 4C  Exit.L64°Write.L
0110: 36 34 00 0A 2F 2F 20 20 20 20 20 20 20 20 20 20  64°¬//¯¯¯¯¯¯¯¯¯¯
0120: 20 20 20 20 30 20 20 20 20 20 20 20 20 20 20 20  ¯¯¯¯0¯¯¯¯¯¯¯¯¯¯¯
0130: 30 20 20 20 20 20 30 20 20 20 20 20 31 30 30 36  0¯¯¯¯¯0¯¯¯¯¯1006
0140: 36 36 20 20 32 20 20 20 20 20 20 20 20 20 60 0A  66¯¯2¯¯¯¯¯¯¯¯¯`¬
0150: 00 0A 74 39 33 33 34 2E 57 42 45 2F 20 20 20 20  °¬t9334.WBE/¯¯¯¯
0160: 20 20 30 20 20 20 20 20 20 20 20 20 20 20 30 20  ¯¯0¯¯¯¯¯¯¯¯¯¯¯0¯
0170: 20 20 20 20 30 20 20 20 20 20 31 30 30 36 36 36  ¯¯¯¯0¯¯¯¯¯100666
0180: 20 20 36 31 33 20 20 20 20 20 20 20 60 0A 64 86  ¯¯613¯¯¯¯¯¯¯`¬d¤
0190: 03 00 00 00 00 00 12 01 00 00 10 00 00 00 00 00  ·°°°°°··°°·°°°°°
01A0: 20 00 2E 74 65 78 74 00 00 00 00 00 00 00 00 00  ¯°.text°°°°°°°°°
01B0: 00 00 59 00 00 00 8C 00 00 00 E6 00 00 00 00 00  °°Y°°°¤°°°¤°°°°°
01C0: 00 00 03 00 00 00 20 00 50 60 2E 72 6F 64 61 74  °°·°°°¯°P`.rodat
01D0: 61 00 00 00 00 00 00 00 00 00 0D 00 00 00 04 01  a°°°°°°°°°·°°°··
01E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00  °°°°°°°°°°°°°°@°
01F0: 50 40 2E 62 73 73 00 00 00 00 00 00 00 00 00 00  P@.bss°°°°°°°°°°
0200: 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00  °°·°°°°°°°°°°°°°
0210: 00 00 00 00 00 00 80 00 50 C0 31 C9 31 C0 48 89  °°°°°°¤°P¤1¤1¤H¤
0220: F7 48 F7 D1 F2 AE 48 F7 D1 B8 01 00 00 00 BF 01  ¤H¤¤¤¤H¤¤¤·°°°¤·
0230: 00 00 00 89 CA 0F 05 C3 48 8D 35 02 00 00 00 E8  °°°¤¤··¤H¤5·°°°¤
0240: D6 FF FF FF 48 8D 35 00 00 00 00 E8 CA FF FF FF  ¤¤¤¤H¤5°°°°¤¤¤¤¤
0250: C3 48 8D 35 00 00 00 00 C7 06 45 6E 64 00 C7 46  ¤H¤5°°°°¤·End°¤F
0260: 03 0A 00 00 00 E8 B0 FF FF FF 31 FF B8 3C 00 00  ·¬°°°¤¤¤¤¤1¤¤<°°
0270: 00 0F 05 00 21 00 00 00 04 00 00 00 04 00 2D 00  °··°!°°°·°°°·°-°
0280: 00 00 04 00 00 00 04 00 3A 00 00 00 02 00 00 00  °°·°°°·°:°°°·°°°
0290: 04 00 07 00 42 65 65 70 69 6E 67 2E 2E 2E 00 00  ·°·°Beeping...°°
02A0: 2E 66 69 6C 65 00 00 00 00 00 00 00 FE FF 00 00  .file°°°°°°°¤¤°°
02B0: 67 01 74 39 33 33 34 2E 68 74 6D 00 00 00 00 00  g·t9334.htm°°°°°
02C0: 00 00 00 00 2E 62 73 73 00 00 00 00 00 00 00 00  °°°°.bss°°°°°°°°
02D0: 03 00 00 00 03 01 00 00 00 00 00 00 00 00 00 00  ·°°°··°°°°°°°°°°
02E0: 00 00 00 00 00 00 00 00 2E 72 6F 64 61 74 61 00  °°°°°°°°.rodata°
02F0: 00 00 00 00 02 00 00 00 03 01 0D 00 00 00 00 00  °°°°·°°°···°°°°°
0300: 00 00 00 00 00 00 00 00 00 00 00 00 2E 74 65 78  °°°°°°°°°°°°.tex
0310: 74 00 00 00 00 00 00 00 01 00 00 00 03 01 59 00  t°°°°°°°·°°°··Y°
0320: 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00  °°·°°°°°°°°°°°°°
0330: 00 00 00 00 04 00 00 00 02 00 00 00 02 00 01 01  °°°°·°°°·°°°·°··
0340: 03 00 00 00 00 00 13 00 00 00 00 00 00 00 02 00  ·°°°°°·°°°°°°°·°
0350: 01 01 03 00 40 4C 54 31 00 00 00 00 02 00 00 00  ···°@LT1°°°°·°°°
0360: 02 00 01 01 03 00 40 4C 54 32 00 00 00 00 00 00  ·°···°@LT2°°°°°°
0370: 00 00 02 00 01 01 03 00 00 00 00 00 1E 00 00 00  °°·°···°°°°°·°°°
0380: 00 00 00 00 03 00 01 01 03 00 42 65 65 70 2E 4C  °°°°·°···°Beep.L
0390: 36 34 1E 00 00 00 01 00 01 02 02 00 45 78 69 74  64·°°°·°···°Exit
03A0: 2E 4C 36 34 37 00 00 00 01 00 01 02 02 00 00 00  .L647°°°·°···°°°
03B0: 00 00 29 00 00 00 00 00 00 00 01 00 01 02 02 00  °°)°°°°°°°·°···°
03C0: 33 00 00 00 3D 42 22 42 65 65 70 69 6E 67 2E 2E  3°°°=B"Beeping..
03D0: 2E 22 00 3D 57 28 30 78 30 30 30 37 29 00 45 78  ."°=W(0x0007)°Ex
03E0: 69 74 2E 4C 36 34 2E 4D 00 57 72 69 74 65 2E 4C  it.L64.M°Write.L
03F0: 36 34 00                                         64°

▲Back to the top▲