Notes on shared objects

This commit is contained in:
Kevin Lange 2014-03-26 21:15:19 -07:00
parent 14009e4198
commit f9999eb490

15
docs/notes.md Normal file
View File

@ -0,0 +1,15 @@
# Shared Object C library
This worked to build a libc.so:
1. Remove `init.o` and `fini.o` from `libc.a`
2. `i686-pc-toaru-gcc -shared -o libc.so -Wl,--whole-archive libc.a -Wl,--no-whole-archive`
3. Remember to not attempt to build userspace like this!
To build a shared object:
i686-pc-toaru-gcc -shared -o libfoo.so foo.c
To build against a shared object in the local directory:
i686-pc-toaru-gcc -L`pwd` -o test test.c -lfoo