EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

Test t9882: ELFX program for 64bit Linux links ELF modules


Source & expected listing t9882.htm.lst
| | EUROASM AUTOSEGMENT=ON,CPU=x64,DUMPWIDTH=28 |7439383832 |%test %SET t9882 | |;; | |;; Create the first auxiliary ELF module. | |%test.WB PROGRAM FORMAT=ELF,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: |[@LT2] ====ListLiterals in section [@LT2]. |00000000:0700 =W(0x0007) |[@LT1] ====ListLiterals in section [@LT1]. |00000000:42656570696E672E~=B"Beeping..." | |ENDPROGRAM %test.WB | **** ListMap "t9882.WB.o",model=FLAT,groups=0,segments=7,entry=,stack= | [],FA=00000000h,RVA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000200h,RVA=00000000h,size=000000C0h=192,width=0,align=8,purpose=SYMBOLS | [.rela.text],FA=000002C0h,RVA=00000000h,size=00000030h=48,width=0,align=8,purpose=RELOC | [.strtab],FA=000002F0h,RVA=00000000h,size=0000003Ch=60,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=0000032Ch,RVA=00000000h,size=00000034h=52,width=0,align=1,purpose=STRINGS | [.text],FA=00000360h,RVA=00000000h,size=00000037h=55,width=64,align=0010h,purpose=CODE | [.rodata],FA=000003A0h,RVA=00000000h,size=0000000Dh=13,width=64,align=0010h,purpose=RODATA+LITERAL | **** ListGlobals "t9882.WB.o",Global=0,Public=2,Extern=0,eXport=0,Import=0 | Beep.L64,[.text]:0000001Eh,scope='P' | Write.L64,[.text]:00000000h,scope='P' | |;; | |;; Create the second auxiliary ELF module. | |%test.EX PROGRAM FORMAT=ELF,MODEL=FLAT,WIDTH=64 |[.text] ::::Section changed. |00000000: |Exit.L64:: PROC ; Display message "End", terminate the program. |00000000:488D35(00000000) | LEA RSI,[.M:] ; String "End" will be defined in segment [.bss] at RSI. |00000007:C706456E6400 | MOVD [RSI+0],"End" ; Dynamically define the message "End". |0000000D:C746030A000000 | MOVD [RSI+3],0x0A ; LF+NUL. |00000014:E8(00000000) | CALL Write.L64:: ; Display the notification "End". |00000019:31FF | XOR EDI,EDI ; %1 Errorlevel=0. |0000001B:B83C000000 | MOV RAX,60 ; Kernel service sys_exit. |00000020: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. |00000022: | ENDPROC Exit.L64: | |ENDPROGRAM %test.EX | **** ListMap "t9882.EX.o",model=FLAT,groups=0,segments=7,entry=,stack= | [],FA=00000000h,RVA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000200h,RVA=00000000h,size=000000C0h=192,width=0,align=8,purpose=SYMBOLS | [.rela.text],FA=000002C0h,RVA=00000000h,size=00000030h=48,width=0,align=8,purpose=RELOC | [.strtab],FA=000002F0h,RVA=00000000h,size=00000039h=57,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=00000329h,RVA=00000000h,size=00000031h=49,width=0,align=1,purpose=STRINGS | [.text],FA=00000360h,RVA=00000000h,size=00000022h=34,width=64,align=0010h,purpose=CODE | [.bss],FA=00000390h,RVA=00000000h,size=00000007h=7,width=64,align=0010h,purpose=BSS | **** ListGlobals "t9882.EX.o",Global=0,Public=1,Extern=1,eXport=0,Import=0 | Exit.L64,[.text]:00000000h,scope='P' | Write.L64,[Write.L64]:00000000h,scope='E' | |;; | |;; Create the main ELFX program. | |%test PROGRAM FORMAT=ELFX,MODEL=FLAT,WIDTH=64,ENTRY=Start: | | LINK %test.WB.o, %test.EX.o |[.text] ::::Section changed. |00000000:90 |Start: NOP ; Entry point of the program. |00000001:488D35(00000000) | LEA RSI,[Msg::] ; Offset of the message. |00000008:E8(00000000) | CALL Write.L64:: ; Write the ASCIIZ string RSI. |0000000D:E8(00000000) | CALL Beep.L64:: ; Play a beep sound. |00000012:E8(00000000) | CALL Exit.L64:: ; Terminate the program with errorlevel 0. |[.data] ::::Section changed. |00000000:363462697420464C~|Msg:: DB '%^WIDTH[]bit %^MODEL %^FORMAT program "%^OUTFILE".',10,0 | | ENDPROGRAM %test |# I0560 Linking ELF module "./t9882.WB.o". |# I0560 Linking ELF module "./t9882.EX.o". | **** ListMap "t9882.x",model=FLAT,groups=4,segments=8,entry=Start:,stack= | [LOAD.HDR],FA=00000000h,VA=00400000h,size=000004E6h=1254,group [.symtab] [.strtab] [.shstrtab] | [],FA=00000000h,VA=00000000h,size=00000000h=0,width=0,align=0,purpose= | [.symtab],FA=00000320h,VA=00400320h,size=00000138h=312,width=0,align=8,purpose=SYMBOLS | [.strtab],FA=00000458h,VA=00400458h,size=0000005Ah=90,width=0,align=1,purpose=STRINGS | [.shstrtab],FA=000004B2h,VA=004004B2h,size=00000034h=52,width=0,align=1,purpose=STRINGS | [LOAD.CODE],FA=000004F0h,VA=004014F0h,size=00000082h=130,group [.text] | [.text],FA=000004F0h,VA=004014F0h,size=00000082h=130,width=64,align=0010h,purpose=CODE | [LOAD.RODATA],FA=00000580h,VA=00402580h,size=0000000Dh=13,group [.rodata] | [.rodata],FA=00000580h,VA=00402580h,size=0000000Dh=13,width=64,align=0010h,purpose=RODATA | [LOAD.DATA],FA=00000590h,VA=00403590h,size=00000037h=55,group [.data] [.bss] | [.data],FA=00000590h,VA=00403590h,size=00000024h=36,width=64,align=0010h,purpose=DATA | [.bss],FA=000005C0h,VA=004035C0h,size=00000007h=7,width=64,align=0010h,purpose=BSS | **** ListGlobals "t9882.x",Global=0,Public=5,Extern=0,eXport=0,Import=0 | Beep.L64,[.text]:0000003Eh,VA=0040152Eh,scope='P' | Exit.L64,[.text]:00000060h,VA=00401550h,scope='P' | Msg,[.data]:00000000h,VA=00403590h,scope='P' | Start,[.text]:00000000h,VA=004014F0h,scope='P' | Write.L64,[.text]:00000020h,VA=00401510h,scope='P'
Expected messages t9882.out
I0180 Assembling source file "t9882.htm". I0270 Assembling source "t9882". I0310 Assembling source pass 1. I0330 Assembling source pass 2 - final. I0470 Assembling program "t9882.WB". "t9882.htm"{45} I0510 Assembling program pass 1. "t9882.htm"{45} I0510 Assembling program pass 2. "t9882.htm"{45} I0530 Assembling program pass 3 - final. "t9882.htm"{45} I0660 64bit FLAT ELF file "t9882.WB.o" created, size=941. "t9882.htm"{72} I0650 Program "t9882.WB" assembled in 3 passes with errorlevel 0. "t9882.htm"{72} I0470 Assembling program "t9882.EX". "t9882.htm"{86} I0510 Assembling program pass 1. "t9882.htm"{86} I0510 Assembling program pass 2. "t9882.htm"{86} I0530 Assembling program pass 3 - final. "t9882.htm"{86} I0660 64bit FLAT ELF file "t9882.EX.o" created, size=898. "t9882.htm"{100} I0650 Program "t9882.EX" assembled in 3 passes with errorlevel 0. "t9882.htm"{100} I0470 Assembling program "t9882". "t9882.htm"{114} I0510 Assembling program pass 1. "t9882.htm"{114} I0510 Assembling program pass 2. "t9882.htm"{114} I0530 Assembling program pass 3 - final. "t9882.htm"{114} I0560 Linking ELF module "./t9882.WB.o". "t9882.htm"{124} I0560 Linking ELF module "./t9882.EX.o". "t9882.htm"{124} I0660 64bit FLAT ELFX file "t9882.x" created, size=1460. "t9882.htm"{124} I0650 Program "t9882" assembled in 3 passes with errorlevel 0. "t9882.htm"{124} I0750 Source "t9882" (274 lines) assembled in 2 passes with errorlevel 0. I0860 Listing file "t9882.htm.lst" created, size=8213. I0990 EuroAssembler terminated with errorlevel 0.
Expected output file t9882. x
0000: 7F 45 4C 46 02 01 01 00 00 00 00 00 00 00 00 00  ¤ELF···°°°°°°°°°
0010: 02 00 3E 00 01 00 00 00 F0 14 40 00 00 00 00 00  ·°>°·°°°¤·@°°°°°
0020: 40 00 00 00 00 00 00 00 20 01 00 00 00 00 00 00  @°°°°°°°¯·°°°°°°
0030: 00 00 00 00 40 00 38 00 04 00 40 00 08 00 03 00  °°°°@°8°·°@°·°·°
0040: 01 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
0050: 00 00 40 00 00 00 00 00 00 00 40 00 00 00 00 00  °°@°°°°°°°@°°°°°
0060: E6 04 00 00 00 00 00 00 E6 04 00 00 00 00 00 00  ¤·°°°°°°¤·°°°°°°
0070: 00 10 00 00 00 00 00 00 01 00 00 00 05 00 00 00  °·°°°°°°·°°°·°°°
0080: F0 04 00 00 00 00 00 00 F0 14 40 00 00 00 00 00  ¤·°°°°°°¤·@°°°°°
0090: F0 14 40 00 00 00 00 00 82 00 00 00 00 00 00 00  ¤·@°°°°°¤°°°°°°°
00A0: 82 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00  ¤°°°°°°°°·°°°°°°
00B0: 01 00 00 00 04 00 00 00 80 05 00 00 00 00 00 00  ·°°°·°°°¤·°°°°°°
00C0: 80 25 40 00 00 00 00 00 80 25 40 00 00 00 00 00  ¤%@°°°°°¤%@°°°°°
00D0: 0D 00 00 00 00 00 00 00 0D 00 00 00 00 00 00 00  ·°°°°°°°·°°°°°°°
00E0: 00 10 00 00 00 00 00 00 01 00 00 00 06 00 00 00  °·°°°°°°·°°°·°°°
00F0: 90 05 00 00 00 00 00 00 90 35 40 00 00 00 00 00  ¤·°°°°°°¤5@°°°°°
0100: 90 35 40 00 00 00 00 00 30 00 00 00 00 00 00 00  ¤5@°°°°°0°°°°°°°
0110: 37 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00  7°°°°°°°°·°°°°°°
0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0160: 01 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
0170: 20 03 40 00 00 00 00 00 20 03 00 00 00 00 00 00  ¯·@°°°°°¯·°°°°°°
0180: 38 01 00 00 00 00 00 00 02 00 00 00 08 00 00 00  8·°°°°°°·°°°·°°°
0190: 08 00 00 00 00 00 00 00 18 00 00 00 00 00 00 00  ·°°°°°°°·°°°°°°°
01A0: 09 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
01B0: 58 04 40 00 00 00 00 00 58 04 00 00 00 00 00 00  X·@°°°°°X·°°°°°°
01C0: 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  Z°°°°°°°°°°°°°°°
01D0: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
01E0: 11 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00  ·°°°·°°°°°°°°°°°
01F0: B2 04 40 00 00 00 00 00 B2 04 00 00 00 00 00 00  ¤·@°°°°°¤·°°°°°°
0200: 34 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  4°°°°°°°°°°°°°°°
0210: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0220: 1B 00 00 00 01 00 00 00 06 00 00 00 00 00 00 00  ·°°°·°°°·°°°°°°°
0230: F0 14 40 00 00 00 00 00 F0 04 00 00 00 00 00 00  ¤·@°°°°°¤·°°°°°°
0240: 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤°°°°°°°°°°°°°°°
0250: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0260: 21 00 00 00 01 00 00 00 02 00 00 00 00 00 00 00  !°°°·°°°·°°°°°°°
0270: 80 25 40 00 00 00 00 00 80 05 00 00 00 00 00 00  ¤%@°°°°°¤·°°°°°°
0280: 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0290: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
02A0: 29 00 00 00 01 00 00 00 03 00 00 00 00 00 00 00  )°°°·°°°·°°°°°°°
02B0: 90 35 40 00 00 00 00 00 90 05 00 00 00 00 00 00  ¤5@°°°°°¤·°°°°°°
02C0: 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  $°°°°°°°°°°°°°°°
02D0: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
02E0: 2F 00 00 00 08 00 00 00 03 00 00 00 00 00 00 00  /°°°·°°°·°°°°°°°
02F0: C0 35 40 00 00 00 00 00 C0 05 00 00 00 00 00 00  ¤5@°°°°°¤·°°°°°°
0300: 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0310: 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ·°°°°°°°°°°°°°°°
0320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0330: 00 00 00 00 00 00 00 00 01 00 00 00 04 00 F1 FF  °°°°°°°°·°°°·°¤¤
0340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  °°°°°°°°°°°°°°°°
0350: 0B 00 00 00 03 00 07 00 C0 35 40 00 00 00 00 00  ·°°°·°·°¤5@°°°°°
0360: 00 00 00 00 00 00 00 00 10 00 00 00 03 00 06 00  °°°°°°°°·°°°·°·°
0370: 90 35 40 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤5@°°°°°°°°°°°°°
0380: 16 00 00 00 03 00 05 00 80 25 40 00 00 00 00 00  ·°°°·°·°¤%@°°°°°
0390: 00 00 00 00 00 00 00 00 1E 00 00 00 03 00 02 00  °°°°°°°°·°°°·°·°
03A0: 58 04 40 00 00 00 00 00 00 00 00 00 00 00 00 00  X·@°°°°°°°°°°°°°
03B0: 26 00 00 00 03 00 01 00 20 03 40 00 00 00 00 00  &°°°·°·°¯·@°°°°°
03C0: 00 00 00 00 00 00 00 00 2E 00 00 00 03 00 04 00  °°°°°°°°.°°°·°·°
03D0: F0 14 40 00 00 00 00 00 00 00 00 00 00 00 00 00  ¤·@°°°°°°°°°°°°°
03E0: 34 00 00 00 12 00 04 00 2E 15 40 00 00 00 00 00  4°°°·°·°.·@°°°°°
03F0: 19 00 00 00 00 00 00 00 3D 00 00 00 12 00 04 00  ·°°°°°°°=°°°·°·°
0400: 50 15 40 00 00 00 00 00 22 00 00 00 00 00 00 00  P·@°°°°°"°°°°°°°
0410: 46 00 00 00 11 00 06 00 90 35 40 00 00 00 00 00  F°°°·°·°¤5@°°°°°
0420: 24 00 00 00 00 00 00 00 4A 00 00 00 12 00 04 00  $°°°°°°°J°°°·°·°
0430: F0 14 40 00 00 00 00 00 01 00 00 00 00 00 00 00  ¤·@°°°°°·°°°°°°°
0440: 50 00 00 00 12 00 04 00 10 15 40 00 00 00 00 00  P°°°·°·°··@°°°°°
0450: 1E 00 00 00 00 00 00 00 00 74 39 38 38 32 2E 68  ·°°°°°°°°t9882.h
0460: 74 6D 00 2E 62 73 73 00 2E 64 61 74 61 00 2E 72  tm°.bss°.data°.r
0470: 6F 64 61 74 61 00 2E 73 74 72 74 61 62 00 2E 73  odata°.strtab°.s
0480: 79 6D 74 61 62 00 2E 74 65 78 74 00 42 65 65 70  ymtab°.text°Beep
0490: 2E 4C 36 34 00 45 78 69 74 2E 4C 36 34 00 4D 73  .L64°Exit.L64°Ms
04A0: 67 00 53 74 61 72 74 00 57 72 69 74 65 2E 4C 36  g°Start°Write.L6
04B0: 34 00 00 2E 73 79 6D 74 61 62 00 2E 73 74 72 74  4°°.symtab°.strt
04C0: 61 62 00 2E 73 68 73 74 72 74 61 62 00 2E 74 65  ab°.shstrtab°.te
04D0: 78 74 00 2E 72 6F 64 61 74 61 00 2E 64 61 74 61  xt°.rodata°.data
04E0: 00 2E 62 73 73 00 00 00 00 00 00 00 00 00 00 00  °.bss°°°°°°°°°°°
04F0: 90 48 8D 35 98 20 00 00 E8 13 00 00 00 E8 2C 00  ¤H¤5¤¯°°¤·°°°¤,°
0500: 00 00 E8 49 00 00 00 90 90 90 90 90 90 90 90 90  °°¤I°°°¤¤¤¤¤¤¤¤¤
0510: 31 C9 31 C0 48 89 F7 48 F7 D1 F2 AE 48 F7 D1 B8  1¤1¤H¤¤H¤¤¤¤H¤¤¤
0520: 01 00 00 00 BF 01 00 00 00 89 CA 0F 05 C3 48 8D  ·°°°¤·°°°¤¤··¤H¤
0530: 35 4D 10 00 00 E8 D6 FF FF FF 48 8D 35 3F 10 00  5M·°°¤¤¤¤¤H¤5?·°
0540: 00 E8 CA FF FF FF C3 90 90 90 90 90 90 90 90 90  °¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
0550: 48 8D 35 69 20 00 00 C7 06 45 6E 64 00 C7 46 03  H¤5i¯°°¤·End°¤F·
0560: 0A 00 00 00 E8 A7 FF FF FF 31 FF B8 3C 00 00 00  ¬°°°¤¤¤¤¤1¤¤<°°°
0570: 0F 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ··°°°°°°°°°°°°°°
0580: 07 00 42 65 65 70 69 6E 67 2E 2E 2E 00 00 00 00  ·°Beeping...°°°°
0590: 36 34 62 69 74 20 46 4C 41 54 20 45 4C 46 58 20  64bit¯FLAT¯ELFX¯
05A0: 70 72 6F 67 72 61 6D 20 22 74 39 38 38 32 2E 78  program¯"t9882.x
05B0: 22 2E 0A 00                                      ".¬°

▲Back to the top▲