On Saturday, 14 June 2014 at 13:05:52 UTC, Mike Wey wrote:
On 06/14/2014 02:01 PM, Reuben wrote:
On Saturday, 14 June 2014 at 10:45:25 UTC, Mike Wey wrote:
On 06/14/2014 03:58 AM, Reuben wrote:
Depending on the desired behavior you'll need to remove the
-shared
flag from the configuration or add -defaultlib=:libphobos2.so
dmd.conf contains the default settings. I haven't specified
-shared
anywhere. The only thing I can think of is that if -fPIC is
required,
DMD might be implying it somehow.
Try running "dmd test.d -v" the last line in the outpus from
dmd should show hows it's invoking gcc for the linking step.
Posting that here might give us some clue of what dmd is doing.
dmd test.d -v
gcc test.o -o test -m64 -L/opt/dmd-2.065/lib64 -Xlinker -rpath
-Xlinker /opt/dmd-2.065/lib64 -Xlinker --export-dynamic
-l:libphobos2.a -lpthread -lm -lrt
dmd -defaultlib=:libphobos2.so -fPIC test.d -v
gcc test.o -o test -m64 -L/opt/dmd-2.065/lib64 -Xlinker -rpath
-Xlinker /opt/dmd-2.065/lib64 -Xlinker --export-dynamic
-l:libphobos2.so -lpthread -lm -lrt
It looks like the only difference is which version of Phobos we
link. I think the reason for this might be that since my version
of gcc is hardened, it uses -fPIE by default for linking.
(http://wiki.gentoo.org/wiki/Hardened/Toolchain#Automatic_generation_of_Position_Independent_Executables_.28PIEs.29)