Thanks for answering sir Bogdan, yes, make sense your words.
The source code that I have worked follows:
solasm
section "text" class_code alias ".text"
.USE64
.text
.entry _start
_start:
mov al,byte [rip]
mov ax,word [rip]
mov eax,dword [rip]
mov rax,qword [rip]
yasm
;command line: yasm -f elf64 -o obj.o obj.asm
section .text
global _start
_start:
mov al,byte [rip]
mov ax,word [rip]
mov eax,dword [rip]
mov rax,qword [rip]
as
#command line: as -o quiz.o quiz.asm
.intel_syntax noprefix
.text
.global _start
_start:
mov al,byte ptr [rip]
mov ax,word ptr [rip]
mov eax,dword ptr [rip]
mov rax,qword ptr [rip]
To archieve that on solasm after read your post I have done this source code
;sol_asm2 -elf64 quiz.solasm quiz.o
section "text" class_code alias ".text"
.USE64
.text
.entry _start
_start:
mov al,byte [one]
one:
mov ax,word [two]
two:
mov eax,dword [three]
three:
mov rax,qword [four]
four:
But disassembled code is not equal, maybe I'm doing something wrong but have some displacement:
$ yasm -f elf64 -o quiz.o quiz.yasm
$ ld -s -m elf_x86_64 -o quiz quiz.o
$ objdump -d -Mintel quiz.o
0000000000000000 <_start>:
0: 8a 05 00 00 00 00 mov al,BYTE PTR [rip+0x0] # 6 <_start+0x6>
6: 66 8b 05 00 00 00 00 mov ax,WORD PTR [rip+0x0] # d <_start+0xd>
d: 8b 05 00 00 00 00 mov eax,DWORD PTR [rip+0x0] # 13 <_start+0x13>
13: 48 8b 05 00 00 00 00 mov rax,QWORD PTR [rip+0x0] # 1a <_start+0x1a>
$ sol_asm2 -elf64 quiz.solasm quiz.o
$ ld -s -m elf_x86_64 -o quiz quiz.o
$ objdump -d -Mintel quiz.o
0000000000000000 <_start>:
0: 8a 05 02 00 00 00 mov al,BYTE PTR [rip+0x2] # 8 <_start+0x8>
6: 66 8b 05 09 00 00 00 mov ax,WORD PTR [rip+0x9] # 16 <_start+0x16>
d: 8b 05 0f 00 00 00 mov eax,DWORD PTR [rip+0xf] # 22 <_start+0x22>
13: 48 8b 05 16 00 00 00 mov rax,QWORD PTR [rip+0x16] # 30 <_start+0x30>
I debug both programs and are generating the same expected results.
Again, thanks a lot sir, I'm enjoying a lot solasm.