Assembly code problem for Linux 64

Asked

Viewed 104 times

1

I created a code for GNU Asssembly 64-bit Linux very simple and it works. Only after strip it stops working. What may be occurring?

Beginning of the code

.section    .rodata

clear:
    .ascii "\033c\0"

size:
    .int . -clear       

.section    .text           
.globl _start           

_start:

_zera:

    xorq        %rax,   %rax
    xorq        %rdi,       %rdi
    xorq        %rsi,       %rsi
    xorq        %rdx,   %rdx

_apaga:

    movq    $1, %rax 
    movq    $1, %rdi
    movq    $clear, %rsi
    movq    size,   %rdx
    syscall

_fim:
    movq    $60,    %rax
    movq    $0,     %rdi
    syscall

Thanks in advance.

  • It is a code that uses terminal escape sequence ( 033c) to clear the screen (like the clear command on Linux). It works before the strip and after the strip no longer works.

  • What’s the problem with the code? Apparently there’s nothing wrong

  • i have driven the code without any problem, have any error giving, like terminal locked? or segmentation failure?

  • No. It just doesn’t clean the screen after the strip. I’m required to use the as (GNU Assembler) with -ggdb option otherwise the program won’t clean the screen. After that, if I wear the strip, it doesn’t clean the screen.

  • places the steps you are taking for the compilation and execution of the code

  • So it works: as clrscr_64-001.s -o clrscr_64-001.o -ggdb Ld clrscr_64-001.o -o clrscr_64-001 So it doesn’t work: as clrscr_64-001.s -o clrscr_64-001.o Ld clrscr_64-001.o -o clrscr_64-001.

  • worked both ways, check the version of as, anything try to make the code in another language. mine is in version 2.26.0 with binutils 2.26.0.20160302

  • What does another language mean? The version is 2.25 in Debian 8 Stable. When I made this code for x86 it worked. Now for x86_64 is not working as due.

  • in another language like C, python, perl, etc. but if it worked for 32x and for 64x no, it might be some problem with your libraries.

  • I tested it on Slackware and it was the same.

  • Unfortunately it still doesn’t work. I’ve tested it on two different 64-bit systems, with different assemblers. Works only with -ggdb option mount. Without the option or after strip, the code does not erase characters from the screen. It works by printing the escape sequence " 033c", which is an <ESC> (ascii 27) followed by a lowercase 'c'. This print works in other languages and even BASH script.

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.