D-Programming-Language/phobos — pull request #875 by Monnoroch (2012-10-16 14:02:25+00:00)
Title: Added support for compiling phobos as PIC.

This is a fix of the following bug, which appears on x86-64 systems:
:~/testD$ make
dmd -m64 -c -fPIC -J. -I. test.d
gcc -m64 test.o -lrt -lpthread -shared -o libtest.so -Bstatic -lphobos2
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libphobos2.a(stdio.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libphobos2.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

Fix essentually just adds a support for the PIC code generation while making a druntime and phobos library. To compile library as PIC (with -fPIC flag in gcc) use "make PIC=true".