Hi all,
I'm learning GAS assmbler, and I've written the following test program:

.code32

.section .data
    values:
    .int 1,2,3,4,5,6,7,8,9
    output:
    .asciz "current value %d"

.section .text
    .globl _start
    _start:
    movl $10, %edi
    loop:
    movl values(,%edi,4),%eax
    pushl %eax
    pushl $output
    call printf
    addl $8, %esp
    dec %edi
    jnz loop
    pushl $0
    call exit

Since I'm on x64, but the code is for 32bit asm, I've assembled it using this command:
as --32 -o test.o test.asm
This command seems to produce a valid obj file.
The problem is that I'm not able to link this file to produce a valid elf32...
I'm using this command:
ld -dynamic-linker /lib/ld-linker.so.2 -lc -o stampa stampa.o -melf_i386
but it says that /usr/lib64/libc.so is not compatible with -lc

How should I link my test program ?? Thank you very much!

You need to install the 32 bit libraries:
ia32-libs
or
ia32-libs-multiarch
With your package manager or:

sudo apt-get install ia32-libs

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.