On Sun, Oct 6, 2013 at 11:50 PM, CNZhangQuan <cnzhangquan@xxxxxxxxx> wrote: > > i want to build a 'static toolchain', with option --disable-shared, > for no shared library include/depend in the toolchain-self > > cause i don't want the target binary runs depend on the toolchain, > such as libc.so, ld-xxx.so. > > > but when the target binary need the function dlopen, it give a build > error that libc.a need to recompile with -fPIC > > > so, how to compile glibc with -fPIC? You will need to ask the glibc developers. This is the GCC help list, not the glibc list, and different people work on the different projects. When writing to the glibc list you should explain how you managed to compile glibc *without* -fPIC. > or maybe i should ask is it possible to gen a shared library with > static toolchain? Yes, it is. To say a "static toolchain" effectively just means using different defaults. In fact you could probably do what you want with just a minor edit of gcc/gcc.c to add -static to LINK_COMMAND_SPEC. Although you would only want to add it if some option (perhaps --no-static?) where not present. Ian