#!/bin/sh
#mk.rc

### This makes startup.
gcc -c crt0.S -o crt0.o

### This makes sample main program.
gcc -c test.c -o test.o

### This makes shared library.
gcc -fPIC -c MAIN.c -o MAIN.o
gcc -shared -Wl,-soname=libtest.so.1 MAIN.o -o libtest.so.1
ln -s libtest.so.1 libtest.so

### This makes static library.
gcc -c MAIN.c -o MAIN_st.o
ar r libtest.a MAIN_st.o

### This makes final object(Without libtest.so). This runs OK. 
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test -L. crt0.o test.o

### This makes static linked final object. This runs OK.
ld -m elf_i386 -static -o test -L. crt0.o test.o -ltest

### This makes final object(With libtest.so). Why error occured?
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test -L. crt0.o test.o -ltest

gcc -v
ld -v
