no save
Assistance
Achat
News

Forum | programmation
du C en asm
kokliko, le ven. 04 mars 2005 à 23:27:03
Bonjour, j'ai trouve un moyen avec gcc


bash-2.05b$ cat hw.c
#include <stdio.h>

int main()
{
printf("hello world");
}
bash-2.05b$ gcc -S hw.c
bash-2.05b$ cat hw.s
.file "hw.c"
.section .rodata
.LC0:
.string "hello world"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
subl $12, %esp
pushl $.LC0
call printf
addl $16, %esp
leave
ret
.size main, .-main
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.3.4"
bash-2.05b$ nasm hw.s
hw.s:1: error: attempt to define a local label before any non-local labels
hw.s:1: error: parser: instruction expected
hw.s:2: error: attempt to define a local label before any non-local labels
hw.s:2: error: parser: instruction expected
hw.s:3: error: attempt to define a local label before any non-local labels
hw.s:4: error: attempt to define a local label before any non-local labels
hw.s:4: error: parser: instruction expected
hw.s:5: error: attempt to define a local label before any non-local labels
hw.s:6: error: attempt to define a local label before any non-local labels
hw.s:6: error: parser: instruction expected
hw.s:7: error: attempt to define a local label before any non-local labels
hw.s:7: error: parser: instruction expected
hw.s:9: error: parser: instruction expected
hw.s:10: error: parser: instruction expected
hw.s:11: error: parser: instruction expected
hw.s:12: error: parser: instruction expected
hw.s:13: error: symbol `movl' redefined
hw.s:13: error: parser: instruction expected
hw.s:14: error: symbol `subl' redefined
hw.s:14: error: parser: instruction expected
hw.s:15: error: symbol `subl' redefined
hw.s:15: error: parser: instruction expected
hw.s:16: error: symbol `pushl' redefined
hw.s:16: error: parser: instruction expected
hw.s:18: error: parser: instruction expected
hw.s:21: error: parser: instruction expected
hw.s:22: error: parser: instruction expected
hw.s:23: error: parser: instruction expected



On dirait pas que ca donne du code valide, une idee ?
merci d'avance
PrécédentReeter
févr. 05
me
mai 07
Suivant
REPONSES
Reeter
févr. 05
kokliko
févr. 05
Reeter
févr. 05
kokliko
mars 05
me
mai 07
ekra
mai 07
Version Web
Réalisé par RedShift
no save