# make compile
/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -x c++ -c -Wall -Wno-unknown-pragmas -fno-common -fbounds-check -pipe -g -Wno-deprecated -pipe -o foo.o foo.cpp
/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -shared -o libfoo.so foo.o -lc
/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-ar -rcs libfoo.a foo.o
/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -x c++ -c -Wall -Wno-unknown-pragmas -fno-common -fbounds-check -pipe -g -Wno-deprecated -pipe -o test.o test.cpp
/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -dynamic -L. -lfoo -o test test.o
/opt/crosstool/i686-unknown-linux-gnu/gcc-3.4.1-glibc-2.3.3/bin/i686-unknown-linux-gnu-g++ -static -L. -lfoo -o test.static test.o libfoo.a
# ./test
./test: error while loading shared libraries: ./libfoo.so: cannot restore segment prot after reloc: Permission d[...]
Here is the solution:
# chcon -t textrel_shlib_t ./libfoo.so