x86 Assembly - printf doesn't print without "\n"
Posted
by
Bitani
on Stack Overflow
See other posts from Stack Overflow
or by Bitani
Published on 2014-06-07T03:18:32Z
Indexed on
2014/06/07
3:25 UTC
Read the original article
Hit count: 177
So I'm confused. I'm going through the book "Programming from the Ground Up" and am working with using libraries.
printf is working just fine so long as I include a "\n" in the string, but without it it will print absolutely nothing.
Any idea why this happens?
Code:
.section .data my_str: .ascii "Jimmy Joe is %d years old!\n\0" my_num: .long 76 .section .text .globl _start _start: pushl my_num pushl $my_str call printf movl $1, %eax movl $0, %ebx int $0x80
Also, when I use -m elf_i386 for 32-bit mode and -dynamic-linker /lib/ld-linux.so.2 -lc to link, I get the warning
ld: skipping incompatible /usr/lib64/libc.so when searching for -lc
If that makes any difference, or if anybody has any suggestions as to how to have it load the 32-bit library directly.
Thanks!
© Stack Overflow or respective owner