As a newbie I found that I have to write init codes like crt0-ia32.S for L4 applications. I was really wondering where crt0 is from.
I found the following command in ld 2.9.1 manual.
$ ld -o output /lib/crt0.o hello.o -lc
My debian stable etch doesn't have /lib/crt0.o, instead, has /usr/lib/crt1.o
I thought my application with the next source working on Linux will be built as shown below:
Code: Select all
#include <stdio.h>
int main(void)
{
return 0;
}
Code: Select all
$ ld m.o /usr/lib/crt1.o /usr/lib/libc.a
/usr/lib/libc.a(elf-init.o): In function `__libc_csu_init': undefined reference to `_init'
/usr/lib/libc.a(elf-init.o): In function `__libc_csu_fini': undefined reference to `_fini'
Now it says I can't resolve the symbols, '_init' and '_fini'. Which object file has those symbols?? I'd like to ask this out of my curiosity. Thank you.
aeeee! one more thing I'd like to know is about ld script.
Does anyone know good tutorial how to write a ld script? ld manual isn't enough, it's too rough because I'm a beginner. I need help.