Ticket #30 (closed defect: fixed)
Assembler generates extra opcodes
| Reported by: | michaelryan@… | Owned by: | peter@… |
|---|---|---|---|
| Priority: | P2 | Milestone: | 0.4.0 |
| Component: | Architecture: x86 | Version: | 0.3.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
For this AMD64 program:
[BITS 64]
[SECTION .text]
global main
main:
;
; Standard entry linkage
;
push rbp
mov rbp,rsp
push rbx
push rsi
push rdi
push QWORD Hello
add rsp,8
;
; Standard return linkage
;
pop rdi
pop rsi
pop rbx
mov rsp,rbp
pop rbp
xor rax,rax
ret
[SECTION .data]
Hello: db 'Hello, World',10,0
this is the generated code:
Dump of assembler code for function main:
0x00000000004004c0 <main+0>: push %rbp
0x00000000004004c1 <main+1>: mov %rsp,%rbp
0x00000000004004c4 <main+4>: push %rbx
0x00000000004004c5 <main+5>: push %rsi
0x00000000004004c6 <main+6>: push %rdi
0x00000000004004c7 <main+7>: pushq $0x500690
0x00000000004004cc <main+12>: add %al,(%rax)
0x00000000004004ce <main+14>: add %al,(%rax)
0x00000000004004d0 <main+16>: add $0x8,%rsp
0x00000000004004d7 <main+23>: pop %rdi
0x00000000004004d8 <main+24>: pop %rsi
0x00000000004004d9 <main+25>: pop %rbx
0x00000000004004da <main+26>: mov %rbp,%rsp
0x00000000004004dd <main+29>: pop %rbp
0x00000000004004de <main+30>: xor %rax,%rax
0x00000000004004e1 <main+33>: retq
The opcodes at 4004cc and 4004ce do not appear in the source.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
