I am trying to compile a small program in a Linux assembly on Intel architecture. I want to use some functions of the C library, but this is not related.
Here is my build program:
.text .globl main main: pushl $512 call malloc addl $4, %esp mov $1, %eax mov $0, %ebx int $0x80
I am compiling with
as --32 -o output.o output.asm
everything is going well here. And then when I contact
ld -static -m elf_i386 -o a.out output.o -lc
I got the following errors:
(. text + 0x1b8): _Unwind_Resume' /usr/lib32/libc.a(iofclose.o):(.eh_frame+0x167): undefined reference to __ gcc_personality_v0 '/usr/lib32/libc.a(iofflush. _unwind_Resume' /usr/lib32/libc.a o): fflush': (.text+0xd7): undefined reference to function fflush': (.text+0xd7): undefined reference to _Unwind_Resume "/ usr / lib 32 / libc.a (iofflush.o) :(. eh_frame + 0xdf): undefined reference to __gcc_personality_v0' /usr/lib32/libc.a(iofputs.o): In function fputs ': (.text + 0x108): undefined link to _Unwind_Resume' /usr/lib32/libc.a(iofputs.o):(.eh_frame+0xdf): undefined reference to __ gcc_personality_v0 '/ usr / lib32 / libc.a (iofwrite.o): function `FWRITE':
(I have one more error, but this is enough to see the problem, I think)
I saw some solutions indicating that I should reference -lgcc, but no library was found on my computer ...
Does anyone have an idea?
source share