|
From: | Abel Romero Pérez |
Subject: | GAS compiling error |
Date: | Wed, 10 Nov 2010 00:46:39 +0100 |
Hello binutil's staff, I was writing a simple code and compiling it with gas. The code is what follows: .globl _start .globl setuid .section .text _start: call write call setuid jmp exit write: movq $4, %rax movq $1, %rbx push $0x4142430a mov %rsp, %rcx // here seems to be the error movq $4, %rdx int $0x80 retq setuid: movq $23, %rax xor %rbx, %rbx int $0x80 retq exit: movq $1, %rax movq $0, %rbx int $0x80 .section .rodata text: .ascii "writed.\n"; text_l = . - text -- When assembled and linked with gas and ld I obtain a binary. So everything goes fine. When I execute that binary I obtain a segvfault. I have the occurence of use gdb for viewing the code (which is okay) but when runned it (the binary) I obtained the next segvfault: Program received signal SIGSEGV, Segmentation fault. 0x000000004142430a in ?? () It seems to be moving the content of %rsp to %rcx instead of the address contained by %rsp. Like doing: mov (%rsp), %rcx. But disassembling its okay... and it diferenciates between one form and the another form. Abel. Regards. |
[Prev in Thread] | Current Thread | [Next in Thread] |