here is a simple program that uses calls to c functions:
.section .data
values: .int 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60
output: .asciz "The value is %d\n"
.section .text
.globl _start
_start:
nop
movl $0, %edi
xor %rax, %rax
loop:
movl values(, %edi, 4 ), %eax
pushq %rax
pushq $output
call printf
inc %edi
cmpl $11, %edi
jne loop
movl $1, %eax
movl $0, %ebx
int $0x80
have tried linking with two different libraries
the first one i typed: ld -dynamic-link /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -lc -o frog frog.o
with this i got the following error : "Segmentation fault.
I know the main cause is the the call to printf
the second thing i tried was : ld -dynamic-link /lib/ld-linux.so.2 -lc -o frog frog.o
with this the error i got was: "bash: ./frog: Accessing a corrupted shared library"
is there like i specific library i must use or download
Edited by dargueta, 03 December 2011 - 02:23 PM.


Sign In
Create Account


Back to top









