Here is my assembly code:
-asm
.section .data
mystring: .asciz "Hello world\n"
.section .text
.globl _start
_start:
pushl $0
pushl $mystring
call printf
pushl $0
call exit
I am trying to assemble and link this code in my 64 bit ubuntu machine **in 32 bit mode**. This code is assembled successfully with this command :
-shell
as -32 demo.s -o demo.o
but when i try to link it with ld command :
-shell
ld -m elf_i386 -s demo.o -o demo -lc
its giving this error :
ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
ld: cannot find -lc: No such file or directory
ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
What should I do for this?
This is my libc.so
locations:
libcjson.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcjson.so.1
libc.so.6 (libc6,x86-64) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (libc6) => /lib/i386-linux-gnu/libc.so.6
Asked by Swapnil
(47 rep)
Sep 2, 2023, 06:57 AM
Last activity: Sep 15, 2023, 12:09 PM
Last activity: Sep 15, 2023, 12:09 PM