GTK program v NASM

Sekcia: Programovanie 22.07 | 09:31
Avatar gtk   Návštevník

Aj taky ludia sa najdu: drag and drop

    • RE: GTK program v NASM 22.07 | 09:52
      Avatar WlaSaTy   Návštevník

      Ide to aj jednoduchšie:

      ~$ cat hello.c 
      #include <stdio.h>
      
      int main () {
      	printf("hell%sworld\n","o ");
      	return 0;
      }
      ~$ gcc -S hello.c 
      ~$ cat hello.s
      	.file	"hello.c"
      	.section	.rodata
      .LC0:
      	.string	"o "
      .LC1:
      	.string	"hell%sworld\n"
      	.text
      	.globl	main
      	.type	main, @function
      main:
      .LFB0:
      	.cfi_startproc
      	pushq	%rbp
      	.cfi_def_cfa_offset 16
      	.cfi_offset 6, -16
      	movq	%rsp, %rbp
      	.cfi_def_cfa_register 6
      	movl	$.LC0, %esi
      	movl	$.LC1, %edi
      	movl	$0, %eax
      	call	printf
      	movl	$0, %eax
      	popq	%rbp
      	.cfi_def_cfa 7, 8
      	ret
      	.cfi_endproc
      .LFE0:
      	.size	main, .-main
      	.ident	"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609"
      	.section	.note.GNU-stack,"",@progbits
      ~$ 
      ~$ gcc hello.s -o hello
      ~$ ./hello 
      hello world
      ~$
      </stdio.h>